Skip to content

TST: added test for fixed bug gh#50372 #54701

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 3 commits into from
Aug 23, 2023

Conversation

DRiXD
Copy link
Contributor

@DRiXD DRiXD commented Aug 23, 2023

I added a test to prevent the bug described in GG#50372 from happening again.

@@ -1252,6 +1252,22 @@ def test_type_error_multiindex(self):
result = dg["x", 0]
tm.assert_series_equal(result, expected)

def test_tuple_string_column_names(self):
Copy link
Member

Choose a reason for hiding this comment

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

Can you move this to pandas/tests/indexing/multiindex/test_getitem.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done @mroeschke


df_flat = df_flat[[("a", "aa"), "new_single_index"]]

assert df_flat.columns.equals(Index([("a", "aa"), "new_single_index"]))
Copy link
Member

Choose a reason for hiding this comment

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

Can you construct the full pandas object result of df_flat and use tm.assert_equal?

result = df_flat[[("a", "aa"), "new_single_index"]]
expected = ...
tm.assert_equal(result, expected)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also done (: @mroeschke

@mroeschke mroeschke added the Testing pandas testing functions or related to the test suite label Aug 23, 2023
@mroeschke mroeschke added this to the 2.2 milestone Aug 23, 2023
@mroeschke mroeschke merged commit 43a3f0e into pandas-dev:main Aug 23, 2023
@mroeschke
Copy link
Member

Thanks @DRiXD

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

Successfully merging this pull request may close these issues.

BUG: Can't mix tuples and strings in column names with Numpy>=1.24
2 participants