Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TST: Testing for mixed int/str Index#61349

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
xaris96 wants to merge71 commits intopandas-dev:main
base:main
Choose a base branch
Loading
fromxaris96:issue-TM

Conversation

xaris96
Copy link

@xaris96xaris96 commentedApr 24, 2025
edited
Loading

pelagiavlasand others added26 commitsMarch 26, 2025 22:58
@datapythonista
Copy link
Member

@xaris96 Can you fix the broken tests and remove all your debug files from this PR please?

@datapythonistadatapythonista added Testingpandas testing functions or related to the test suite IndexRelated to the Index class or subclasses labelsMay 3, 2025
@datapythonistadatapythonista changed the titleIssue tmTST: Testing for mixed int/str IndexMay 3, 2025
@xaris96xaris96 requested a review frommroeschkeMay 14, 2025 13:47
Copy link
Member

Choose a reason for hiding this comment

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

This file should have not been changed

Copy link
Member

Choose a reason for hiding this comment

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

This file should have not been changed

Copy link
Member

Choose a reason for hiding this comment

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

This file should not have changed

Copy link
Author

Choose a reason for hiding this comment

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

Yes, I’m aware — as I mentioned earlier, I ran into an unexpected issue with the test_rolling.py file. It had been working fine before and I hadn’t modified it, so I’m not sure why it started failing. Please let me know if it is a common failure or if there is any other solution for this.

@xaris96xaris96 requested a review frommroeschkeMay 15, 2025 11:31
xaris96and others added6 commitsMay 22, 2025 19:30
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
Co-authored-by: Matthew Roeschke <10647082+mroeschke@users.noreply.github.com>
@xaris96xaris96 requested a review frommroeschkeMay 23, 2025 07:30
mark=pytest.mark.xfail(reason="complex objects are not comparable")
request.applymarker(mark)
request.applymarker(pytest.mark.xfail(reason="GH 14833",strict=False))
return
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 remove all thesereturns? We want to apply themark and then let the test run as normal

Copy link
Member

@mroeschkemroeschke left a comment

Choose a reason for hiding this comment

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

Please review the diff and consistently use these following conventions

  1. Useinferred_type to check for the newmixed-int-string case you added
  2. If a test fails, do notastype orpytest.skip. Add anpytest.mark.xfail to the test instead

Comment on lines +629 to +631
# special case for mixed types
ifindex.inferred_type=="mixed":
index=index.map(str)
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 add anxfail marker here instead?

Comment on lines +443 to +444
if len({type(x) for x in index_with_missing if pd.notna(x)}) > 1:
index_with_missing = index_with_missing.map(str)
Copy link
Member

Choose a reason for hiding this comment

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

Please check.inferred_type andxfail if needed.

Comment on lines +456 to +458
non_na_values = [x for x in index_with_missing if pd.notna(x)]
if len({type(x) for x in non_na_values}) > 1:
index_with_missing = index_with_missing.map(str)
Copy link
Member

Choose a reason for hiding this comment

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

Please check.inferred_type andxfail if needed.

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 remove this file? These tests are exercised across the test suite

Comment on lines +158 to +160
has_str=any(isinstance(x,str)forxinindex)
has_int=any(isinstance(x,int)forxinindex)
ifhas_strandhas_int:
Copy link
Member

Choose a reason for hiding this comment

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

Please check.inferred_type.

Comment on lines +66 to +69
@pytest.mark.parametrize(
"index_or_series_obj", [[1,2,3], ["a","b","c"], [0,"a",1,"b",2,"c"]]
)
@pytest.mark.parametrize("sort", [True,False])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@pytest.mark.parametrize(
"index_or_series_obj", [[1,2,3], ["a","b","c"], [0,"a",1,"b",2,"c"]]
)
@pytest.mark.parametrize("sort", [True,False])

This overrides the original fixtures being used here


foridxin [index1,index2]:
forlvlinrange(idx.nlevels):
ifhas_mixed_types(idx.get_level_values(lvl)):
Copy link
Member

Choose a reason for hiding this comment

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

Please checkinferred_type

Comment on lines +939 to +941
pytest.skip(
f"Mixed types in MultiIndex level{lvl} are not orderable"
)
Copy link
Member

Choose a reason for hiding this comment

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

Please add anxfail marker instead

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@mroeschkemroeschkemroeschke requested changes

@rhshadrachrhshadrachAwaiting requested review from rhshadrach

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Labels
IndexRelated to the Index class or subclassesTestingpandas testing functions or related to the test suite
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

TST: mixed_int_string Index
5 participants
@xaris96@datapythonista@jbrockmendel@mroeschke@pelagiavlas

[8]ページ先頭

©2009-2025 Movatter.jp