Skip to content

TST: reintroduce check_series_type in assert_series_equal #32670

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 8 commits into from
Mar 16, 2020
Merged

TST: reintroduce check_series_type in assert_series_equal #32670

merged 8 commits into from
Mar 16, 2020

Conversation

martinfleis
Copy link
Contributor

  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

Re-introduced check_series_type in assert_series_equal which was recently removed in #32513. It was a part of public API which is not used internally, but it is used elsewhere (like geopandas). Discussion in #32513 suggests that it should be put back where it was.

@WillAyd
Copy link
Member

WillAyd commented Mar 13, 2020

I think worth completely reverting rather than part of the original PR

@jbrockmendel @jorisvandenbossche

@WillAyd WillAyd added Testing pandas testing functions or related to the test suite Dependencies Required and optional dependencies labels Mar 13, 2020
@jbrockmendel
Copy link
Member

I think worth completely reverting rather than part of the original PR

Why is that? #32513 included some non-downstreaming-breaking improvements

@jorisvandenbossche
Copy link
Member

Yes, just adding back only this is perfect IMO. The rest of the PR was actually completely unrelated to this change (regardless of the title of the PR that seemed to indicate otherwise).

@jorisvandenbossche
Copy link
Member

We might want to add a test though

@jorisvandenbossche
Copy link
Member

Added a test

tm.assert_series_equal(s1, s3, check_series_type=False)

with pytest.raises(AssertionError, match="Series type not equal"):
tm.assert_series_equal(s1, s3, check_series_type=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this test include tm.assert_series_equal(s3, s1, check_series_type=True) (with an xfail))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should but the original check_series_type should also be extended as
isinstance(s3, type(s1)) is True while isinstance(s1, type(s3)) is False. assert_series_equal should probably return the same result no matter the order of left and right Series.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I think the fix is outside of the scope of this PR since this is simply reverting changes. but if we are adding a new test, the test should probably test all permutations for completeness. Maybe add a TODO comment in the test instead.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just fix it here at once?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could maybe remove the comments in assert_series_equal now?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can just fix it here at once?

@jorisvandenbossche that broke (some) tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, should be easy to fix the test to make proper use of assert_frame_equal, I think (will look at it tomorrow)

@simonjayhawkins simonjayhawkins added this to the 1.1 milestone Mar 13, 2020
@jorisvandenbossche
Copy link
Member

@simonjayhawkins this is passing now. Are you OK with including the fix here?

cc @jbrockmendel

Copy link
Member

@simonjayhawkins simonjayhawkins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. maybe #32670 (comment)

@jorisvandenbossche
Copy link
Member

lgtm. maybe #32670 (comment)

Ah, yes, forgot that. That actually simplified it a lot

@jbrockmendel
Copy link
Member

lgtm

@jorisvandenbossche jorisvandenbossche merged commit 9cf631f into pandas-dev:master Mar 16, 2020
SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dependencies Required and optional dependencies Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants