-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: remove unnecessary check needs_i8_conversion
if Index subclass does not support any
or all
#58006
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
CLN: remove unnecessary check needs_i8_conversion
if Index subclass does not support any
or all
#58006
Changes from 3 commits
c3cf9a1
54983c5
3b2242f
c253533
923aa2f
0b71ac1
01ce724
add58c0
be3ab97
18fab28
c887a85
bac52c5
6efebb8
4ff9cea
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 |
---|---|---|
|
@@ -216,7 +216,12 @@ def test_logical_compat(self, simple_index): | |
if simple_index.dtype in (object, "string"): | ||
pytest.skip("Tested elsewhere.") | ||
idx = simple_index | ||
if idx.dtype.kind in "iufcbm": | ||
|
||
if isinstance(idx, DatetimeIndex): | ||
msg = "'(any|all)' with datetime64 dtypes is deprecated" | ||
with tm.assert_produces_warning(FutureWarning, match=msg): | ||
idx.all() | ||
elif idx.dtype.kind in "iufcbm": | ||
assert idx.all() == idx._values.all() | ||
assert idx.all() == idx.to_series().all() | ||
assert idx.any() == idx._values.any() | ||
|
@@ -228,6 +233,8 @@ def test_logical_compat(self, simple_index): | |
r"'IntervalArray' with dtype interval\[.*\] does " | ||
"not support reduction '(any|all)'" | ||
) | ||
if isinstance(idx, PeriodIndex): | ||
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. I think you can combine this branch with the IntervalArray branch directly preceding it and reduce the msg check to It is generally a good idea to try and reduce the amount of branching in tests. Having a bunch of if...else statements makes it unnecessarily harder to manage consistent behavior expectations |
||
msg = "does not support reduction '(any|all)'" | ||
with pytest.raises(TypeError, match=msg): | ||
idx.all() | ||
with pytest.raises(TypeError, match=msg): | ||
|
Uh oh!
There was an error while loading. Please reload this page.