-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
DEPR: Raise FutureWarning
about raising an error in __array__ when copy=False cannot be honored
#60395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEPR: Raise FutureWarning
about raising an error in __array__ when copy=False cannot be honored
#60395
Changes from 6 commits
2eb106c
f0bec10
ac0573c
504a484
11ae896
8574f97
fab1f17
1c5d103
f419a91
ce83e09
1820f78
d466e24
9786ee3
f9fc8e8
9731c60
60c5274
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,12 @@ def test_array_interface(idx): | |
return | ||
|
||
# for MultiIndex, copy=False is never allowed | ||
with pytest.raises(ValueError, match="Unable to avoid copy while creating"): | ||
msg = "Starting on NumPy 2.0, the behavior of the 'copy' keyword has changed " | ||
"and passing 'copy=False' raises an error when a zero-copy NumPy array " | ||
"is not possible, Pandas will follow this behavior starting with " | ||
"version 3.0. This conversion to NumPy requires a copy, but " | ||
"'copy=False' was passed. Consider using 'np.asarray(..)' instead." | ||
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's fine to just test a small part of the message, just so we assert the correct message is raised. Something like
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And for the other CI errors, essentially you will have to replace all occurrences of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, will work on this in a couple of days. Been too focused on AoC this December 😆 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is it alright if I match the first part of the message? msg = "Starting with NumPy 2.0, the behavior of the 'copy' keyword"
with tm.assert_produces_warning(FutureWarning, match=msg):
np.array(arr, copy=False) Using msg = "Pandas will follow this behavior starting with version 3.0" is failing |
||
np.array(idx, copy=False) | ||
|
||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.