-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
STY: use pytest.raises context syntax (groupby) #24828
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
Conversation
pandas/tests/groupby/test_groupby.py
Outdated
s.groupby(level=[0, 0]) | ||
with pytest.raises(ValueError, match=msg): | ||
s.groupby(level=[0, 1]) | ||
msg = "level > 0 or level < -1 only valid with MultiIndex" |
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.
i should probably remove the double space as well?
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.
Good catch and yes that would be good
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.
Minor stylistic nits but generally looks good
@@ -26,9 +26,9 @@ class TestSelection(object): | |||
def test_select_bad_cols(self): | |||
df = DataFrame([[1, 2]], columns=['A', 'B']) | |||
g = df.groupby('A') | |||
pytest.raises(KeyError, g.__getitem__, ['C']) # g[['C']] | |||
with pytest.raises(KeyError, match='"Columns not found: '"'C'"'"'): |
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.
Also tough to read with quoting - can you not just escape what you need to?
Codecov Report
@@ Coverage Diff @@
## master #24828 +/- ##
=======================================
Coverage 92.38% 92.38%
=======================================
Files 166 166
Lines 52383 52383
=======================================
Hits 48396 48396
Misses 3987 3987
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24828 +/- ##
==========================================
- Coverage 92.38% 92.38% -0.01%
==========================================
Files 166 166
Lines 52383 52383
==========================================
- Hits 48396 48395 -1
- Misses 3987 3988 +1
Continue to review full report at Codecov.
|
thanks for the review @WillAyd. have made changes as requested. |
lgtm. @WillAyd merge when ok. |
Thanks @simonjayhawkins |
xref #24332