Skip to content

Commit 287fd13

Browse files
authored
Backport PR #62190: TST: Adjust test_round for Numpy 2.4 behavior (#62193)
1 parent 4665c10 commit 287fd13

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/tests/copy_view/test_methods.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
)
1919
import pandas._testing as tm
2020
from pandas.tests.copy_view.util import get_array
21+
from pandas.util.version import Version
2122

2223

2324
def test_copy(using_copy_on_write):
@@ -1199,8 +1200,9 @@ def test_round(using_copy_on_write, warn_copy_on_write, decimals):
11991200
if using_copy_on_write:
12001201
assert tm.shares_memory(get_array(df2, "b"), get_array(df, "b"))
12011202
# TODO: Make inplace by using out parameter of ndarray.round?
1202-
if decimals >= 0:
1203+
if decimals >= 0 and Version(np.__version__) < Version("2.4.0.dev0"):
12031204
# Ensure lazy copy if no-op
1205+
# TODO: Cannot rely on Numpy returning view after version 2.3
12041206
assert np.shares_memory(get_array(df2, "a"), get_array(df, "a"))
12051207
else:
12061208
assert not np.shares_memory(get_array(df2, "a"), get_array(df, "a"))

0 commit comments

Comments
 (0)