Skip to content
14 changes: 14 additions & 0 deletions pandas/tests/util/test_shares_memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,17 @@ def test_shares_memory_string():

obj = pd.array(["a", "b"], dtype=pd.ArrowDtype(pa.string()))
assert tm.shares_memory(obj, obj)


def test_shares_memory_numpy():
arr = np.arange(10)
view = arr[:5]
assert tm.shares_memory(arr, view)
arr2 = np.arange(10)
assert not tm.shares_memory(arr, arr2)


def test_shares_memory_rangeindex():
idx = pd.RangeIndex(10)
arr = np.arange(10)
assert not tm.shares_memory(idx, arr)
Loading