-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: GH30999 Add match=msg to all pytest.raises in tests/indexes #38697
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
Merged
jreback
merged 6 commits into
pandas-dev:master
from
moink:add_match_msg_to_pytest_raises_indexes
Dec 31, 2020
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4cc2668
TST: GH30999 Add match=msg to all pytest.raises in tests/indexes. Rea…
moink 02cbc37
TST: GH30999 Attempt to fix failing test test_numpy_ufuncs_basic
moink d968db1
TST: GH30999 Change pytest.raises in test_numpy_ufuncs_basic to tm.ex…
moink 4fd5b91
TST: GH30999 Allow first pytest.raises in test_numpy_ufuncs_basic to …
moink 5937097
TST: GH30999 Revert change to test_subtype_integer_errors and change …
moink 32eca9a
Merge branch 'master' into add_match_msg_to_pytest_raises_indexes
moink File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -49,8 +49,7 @@ def test_numpy_ufuncs_basic(index, func): | |
# https://numpy.org/doc/stable/reference/ufuncs.html | ||
|
||
if isinstance(index, DatetimeIndexOpsMixin): | ||
# raise TypeError or ValueError (PeriodIndex) | ||
with pytest.raises(Exception): | ||
with tm.external_error_raised((TypeError, AttributeError)): | ||
with np.errstate(all="ignore"): | ||
func(index) | ||
elif isinstance(index, (Float64Index, Int64Index, UInt64Index)): | ||
|
@@ -66,7 +65,7 @@ def test_numpy_ufuncs_basic(index, func): | |
if len(index) == 0: | ||
pass | ||
else: | ||
with pytest.raises(Exception): | ||
with tm.external_error_raised((TypeError, AttributeError)): | ||
with np.errstate(all="ignore"): | ||
func(index) | ||
|
||
|
@@ -77,7 +76,6 @@ def test_numpy_ufuncs_basic(index, func): | |
def test_numpy_ufuncs_other(index, func, request): | ||
# test ufuncs of numpy, see: | ||
# https://numpy.org/doc/stable/reference/ufuncs.html | ||
|
||
if isinstance(index, (DatetimeIndex, TimedeltaIndex)): | ||
if isinstance(index, DatetimeIndex) and index.tz is not None: | ||
if func in [np.isfinite, np.isnan, np.isinf]: | ||
|
@@ -96,13 +94,11 @@ def test_numpy_ufuncs_other(index, func, request): | |
result = func(index) | ||
assert isinstance(result, np.ndarray) | ||
else: | ||
# raise TypeError or ValueError (PeriodIndex) | ||
with pytest.raises(Exception): | ||
with tm.external_error_raised(TypeError): | ||
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. guess these are older comments, cc @jbrockmendel 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 so yah |
||
func(index) | ||
|
||
elif isinstance(index, PeriodIndex): | ||
# raise TypeError or ValueError (PeriodIndex) | ||
with pytest.raises(Exception): | ||
with tm.external_error_raised(TypeError): | ||
func(index) | ||
|
||
elif isinstance(index, (Float64Index, Int64Index, UInt64Index)): | ||
|
@@ -114,5 +110,5 @@ def test_numpy_ufuncs_other(index, func, request): | |
if len(index) == 0: | ||
pass | ||
else: | ||
with pytest.raises(Exception): | ||
with tm.external_error_raised(TypeError): | ||
func(index) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test was marked as failing. But when I switched it to checking that a
ValueError
was raised, it passed. I think this works as intended now.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine, a lot of things have been cleaned up recently I guess this was missed. cc @jbrockmendel