-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
REF/TST: remove overriding tm.assert_foo pattern #54355
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
32d15f4
REF: remove overriding assert_extension_array_equal
jbrockmendel daa5440
REF/TST: remove overriding tm.assert_foo pattern
jbrockmendel b2a09c2
remove the methods
jbrockmendel f1ce02e
Merge branch 'main' into ref-tst-asserts
jbrockmendel 292d297
update usage
jbrockmendel 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
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 |
---|---|---|
@@ -1,17 +1,2 @@ | ||
import pandas._testing as tm | ||
|
||
|
||
class BaseExtensionTests: | ||
# classmethod and different signature is needed | ||
# to make inheritance compliant with mypy | ||
@classmethod | ||
def assert_equal(cls, left, right, **kwargs): | ||
return tm.assert_equal(left, right, **kwargs) | ||
|
||
@classmethod | ||
def assert_series_equal(cls, left, right, *args, **kwargs): | ||
return tm.assert_series_equal(left, right, *args, **kwargs) | ||
|
||
@classmethod | ||
def assert_frame_equal(cls, left, right, *args, **kwargs): | ||
return tm.assert_frame_equal(left, right, *args, **kwargs) | ||
pass | ||
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
Oops, something went wrong.
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 removal is not backward compatible for extensionarrays tests that inherit BaseExtensionTests. IMO this should be deprecated instead?
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.
Is there a downstream EA that is actually affected or is this just in principal?
If the latter, I'm inclined to be more aggressive with changing the tests than the non-test code. I don't want to get in the business of writing deprecation tests for the tests.
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.
Every downstream EA that reuses those tests can be affected if they use the same pattern in those classes (eg in a test they override). See the two linked PRs below for two such examples.
Now, I think the question is: is there any downstream EA implementation that actually makes use of those test class methods (i.e. by overriding them, and thus not relying purely on the base
tm.assert_.._equal
functions). That I don't know (the two examples of affected projects don't do this, and so for them it's an easy fix)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.
Looking at some know downstream EAs, there are a few others that will be affected as well in the sense of having to replace
self.assert_..
withtm.assert_..
, but I didn't see any public one that actually overrides those methods.