-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
TST: change assertion messages in assert_frame_equal (#27023) #27068
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
Ouch, this is my first pandas PR, are all of these failing checks normal? The change is so tiny, I can't imagine what could have gone wrong. |
Ah shoot, I see that there are tests that fail now, which match on the assertion text that I changed. |
I think you are referring to the Haven't looked deep into the failure but hope the above helps |
If in the assert_frame_equal(...
obj='{obj}.blocks'.format(obj=obj)) to just assert_frame_equal(...
obj=obj) the existing tests are happy. Note the original string is hard-coded |
I don't think |
Codecov Report
@@ Coverage Diff @@
## master #27068 +/- ##
===========================================
- Coverage 92.04% 41.86% -50.18%
===========================================
Files 180 180
Lines 50714 50714
===========================================
- Hits 46679 21233 -25446
- Misses 4035 29481 +25446
Continue to review full report at Codecov.
|
1 similar comment
Codecov Report
@@ Coverage Diff @@
## master #27068 +/- ##
===========================================
- Coverage 92.04% 41.86% -50.18%
===========================================
Files 180 180
Lines 50714 50714
===========================================
- Hits 46679 21233 -25446
- Misses 4035 29481 +25446
Continue to review full report at Codecov.
|
Ouch, I'm not not having much luck with this! I don't understand where that drop in coverage could be coming from. Does this mean there is more digging I should be doing? |
Don't worry about codecov it's sometimes spotty. Can you add a test in pandas/tests/util/test_assert_frame_equal.py that ensures this works correctly? |
I'm not sure if I went overboard in the test script, by adding parametrization to all of the existing tests. Let me know, and I'd be happy do revert and redo, as a new test or two. |
@@ -9,6 +9,11 @@ def by_blocks(request): | |||
return request.param | |||
|
|||
|
|||
@pytest.fixture(params=['aaa', 'zzz']) |
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 should also include DataFrame & Series as strings;
can you call this obj_fixture? (and rename by_blocks -> by_blocks_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.
Will do. Is it enough to just include DataFrame and Series as strings in the fixture? Or should that somehow be made to disable specifying obj=
in the tests, to test that expected default value is honoured?
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 think just DataFrame and Series as strings is fine ('aaa' and 'zzz' are kind of arbitrary). You'd have to then replace obj
in your function signatures with obj_fixture
and subsequently change invocations of these assert functions within those tests to obj=obj_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.
Sounds good. This is straining my knowledge of pep8 though!
msg = """{obj}\\.index are different
{obj}\\.index values are different \\(33\\.33333 %\\)
\\[left\\]: Index\\(\\['a', 'b', 'c'\\], dtype='object'\\)
\\[right\\]: Index\\(\\['a', 'b', 'd'\\], dtype='object'\\)""".format(obj=obj_fixture)
I'll read up to figure out how to shorten that last line, but if you see this in the meantime, could you help me out?
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.
Yea you can just break after format(
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.
K, done and pushed. When I revise my PR, I've been amending, then force-push. This time I forgot to fetch and reapply to the current master though. Is there a preferred workflow for revising pull requests?
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 would do this before any change:
git fetch upstream
git merge upstream/master
# if any merge conflicts fix up and
git merge --continue
Then you can just make new commits without amend and push without force
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.
It will be squashed and rebased when it's merge to pandas-dev/pandas though, right? I'll have to force-push after that, but I guess your recipe will keep the history organized until the PR is finally accepted?
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.
We squash before merge
thanks @ajwood |
git diff upstream/master -u -- "*.py" | flake8 --diff