Skip to content

Commit 8cf2e43

Browse files
authored
TST: Adjust test_round for Numpy 2.4 behavior (#62190)
1 parent 37f0532 commit 8cf2e43

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
@@ -16,6 +16,7 @@
1616
)
1717
import pandas._testing as tm
1818
from pandas.tests.copy_view.util import get_array
19+
from pandas.util.version import Version
1920

2021

2122
def test_copy():
@@ -917,8 +918,9 @@ def test_round(decimals):
917918

918919
assert tm.shares_memory(get_array(df2, "b"), get_array(df, "b"))
919920
# TODO: Make inplace by using out parameter of ndarray.round?
920-
if decimals >= 0:
921+
if decimals >= 0 and Version(np.__version__) < Version("2.4.0.dev0"):
921922
# Ensure lazy copy if no-op
923+
# TODO: Cannot rely on Numpy returning view after version 2.3
922924
assert np.shares_memory(get_array(df2, "a"), get_array(df, "a"))
923925
else:
924926
assert not np.shares_memory(get_array(df2, "a"), get_array(df, "a"))

0 commit comments

Comments
 (0)