Thanks to visit codestin.com
Credit goes to github.com

Skip to content
15 changes: 15 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,18 @@ def test_shares_memory_string():

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


# Unit tests for tm.shares_memory (#55372)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this comment isnt helpful

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I will remove this.

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