Skip to content

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 5 commits into from
Aug 1, 2023

Conversation

jbrockmendel
Copy link
Member

Sits on top of #54337

@mroeschke mroeschke added Testing pandas testing functions or related to the test suite ExtensionArray Extending pandas with custom dtypes or arrays. labels Aug 1, 2023
@mroeschke mroeschke added this to the 2.1 milestone Aug 1, 2023
@mroeschke mroeschke merged commit 9db9baa into pandas-dev:main Aug 1, 2023
@mroeschke
Copy link
Member

Thanks @jbrockmendel

@jbrockmendel jbrockmendel deleted the ref-tst-asserts branch August 1, 2023 21:14
@classmethod
def assert_frame_equal(cls, left, right, *args, **kwargs):
return tm.assert_frame_equal(left, right, *args, **kwargs)
pass
Copy link
Contributor

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?

Copy link
Member Author

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.

Copy link
Member

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)

Copy link
Member

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_.. with tm.assert_.., but I didn't see any public one that actually overrides those methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ExtensionArray Extending pandas with custom dtypes or arrays. Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants