From ef25a0f85a8718313fb03ca5606b88737d67b530 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 25 Aug 2025 13:03:39 -0700 Subject: [PATCH 1/2] TST: Adjust test_round for Numpy 2.4 behavior --- pandas/tests/copy_view/test_methods.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pandas/tests/copy_view/test_methods.py b/pandas/tests/copy_view/test_methods.py index 250697c91ff13..7d85d01ad5cfd 100644 --- a/pandas/tests/copy_view/test_methods.py +++ b/pandas/tests/copy_view/test_methods.py @@ -16,6 +16,7 @@ ) import pandas._testing as tm from pandas.tests.copy_view.util import get_array +from pandas.util.version import Version def test_copy(): @@ -917,8 +918,9 @@ def test_round(decimals): assert tm.shares_memory(get_array(df2, "b"), get_array(df, "b")) # TODO: Make inplace by using out parameter of ndarray.round? - if decimals >= 0: + if decimals >= 0 and Version(np.__version__) <= Version("2.3"): # Ensure lazy copy if no-op + # TODO: Cannot rely on Numpy returning view after version 2.3 assert np.shares_memory(get_array(df2, "a"), get_array(df, "a")) else: assert not np.shares_memory(get_array(df2, "a"), get_array(df, "a")) From c45ef0e0285f04d5d933e4c051ee747174a89498 Mon Sep 17 00:00:00 2001 From: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com> Date: Mon, 25 Aug 2025 13:28:19 -0700 Subject: [PATCH 2/2] Use 2.4.0.dev0 --- pandas/tests/copy_view/test_methods.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/tests/copy_view/test_methods.py b/pandas/tests/copy_view/test_methods.py index 7d85d01ad5cfd..8abecd13c7038 100644 --- a/pandas/tests/copy_view/test_methods.py +++ b/pandas/tests/copy_view/test_methods.py @@ -918,7 +918,7 @@ def test_round(decimals): assert tm.shares_memory(get_array(df2, "b"), get_array(df, "b")) # TODO: Make inplace by using out parameter of ndarray.round? - if decimals >= 0 and Version(np.__version__) <= Version("2.3"): + if decimals >= 0 and Version(np.__version__) < Version("2.4.0.dev0"): # Ensure lazy copy if no-op # TODO: Cannot rely on Numpy returning view after version 2.3 assert np.shares_memory(get_array(df2, "a"), get_array(df, "a"))