-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
REF/TST: Add more pytest idiom to indexing/multiindex/test_getitem.py #24452
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
Codecov Report
@@ Coverage Diff @@
## master #24452 +/- ##
==========================================
+ Coverage 92.3% 92.31% +<.01%
==========================================
Files 163 163
Lines 51987 51987
==========================================
+ Hits 47989 47990 +1
+ Misses 3998 3997 -1
Continue to review full report at Codecov.
|
All reactions
Sorry, something went wrong.
Codecov Report
@@ Coverage Diff @@
## master #24452 +/- ##
==========================================
- Coverage 92.3% 92.3% -0.01%
==========================================
Files 163 163
Lines 51987 51969 -18
==========================================
- Hits 47989 47968 -21
- Misses 3998 4001 +3
Continue to review full report at Codecov.
|
All reactions
Sorry, something went wrong.
|
||
|
||
def test_getitem_int(multiindex_dataframe_random_data): | ||
@pytest.fixture |
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.
ideally put the fixtures at the top
Sorry, something went wrong.
All reactions
frame = multiindex_dataframe_random_data.T | ||
expected = frame | ||
df = frame.copy() | ||
|
||
try: |
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.
don't do things like this; use the context manager like above
Sorry, something went wrong.
All reactions
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've changed as requested. though not convinced this is the right thing to do in situations like this. the previous test tested that the chained assignment raised the correct exception and this test is to check that the dataframe values are unchanged. having a context manager in the test adds unnecessary/unseen setup and teardown code that could potentially interfere with the tested functionality.
Sorry, something went wrong.
All reactions
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.
yeah this must have been changed a while back, the context manager is the correct idiom
Sorry, something went wrong.
All reactions
thanks @simonjayhawkins |
All reactions
Sorry, something went wrong.
Successfully merging this pull request may close these issues.
None yet
git diff upstream/master -u -- "*.py" | flake8 --diff
in this pass: