diff --git a/pandas/tests/util/test_shares_memory.py b/pandas/tests/util/test_shares_memory.py index 8f1ac93b40247..94bc51dca3f60 100644 --- a/pandas/tests/util/test_shares_memory.py +++ b/pandas/tests/util/test_shares_memory.py @@ -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)