Skip to content

Commit 8cab820

Browse files
Aniketsyzhangbowen-coder
authored andcommitted
TST : Add comprehensive unit tests for tm.shares_memory utility function (GH#55372) (pandas-dev#62291)
1 parent dd87cbe commit 8cab820

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tests/util/test_shares_memory.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,17 @@ def test_shares_memory_string():
3030

3131
obj = pd.array(["a", "b"], dtype=pd.ArrowDtype(pa.string()))
3232
assert tm.shares_memory(obj, obj)
33+
34+
35+
def test_shares_memory_numpy():
36+
arr = np.arange(10)
37+
view = arr[:5]
38+
assert tm.shares_memory(arr, view)
39+
arr2 = np.arange(10)
40+
assert not tm.shares_memory(arr, arr2)
41+
42+
43+
def test_shares_memory_rangeindex():
44+
idx = pd.RangeIndex(10)
45+
arr = np.arange(10)
46+
assert not tm.shares_memory(idx, arr)

0 commit comments

Comments
 (0)