-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…t_values_invalid_na_position
…t_values_with_missing
…xes\multi\test_setops.py
@xaris96 Can you fix the broken tests and remove all your debug files from this PR please? |
@datapythonista okay. no problem. i would like to ask about the pr. Do we need to fix the failed tests that already existed to pass the pr? we are new to this and need some guidance :) |
I think the main idea of the issue is to add the mixed index to the tests, see what it fails, fix the bugs of things that don't work with an index with mix types, and if there are tests that need to be updated, also fix that. Since I think several things will be broken, maybe you can open a first PR with just adding the index with mixed types, then write the failures in a comment to the issue, and then address them in individual PRs. But up to you, whatever you consider it makes things easier. @jbrockmendel anything you'd like to add? |
@datapythonista thanks for the advise. it is really helpful! |
@datapythonista also one more question. is there any problem or do we create a mess if we making changes and update this pr? or this is the common tactic? |
A PR is mainly a UI for your fork's branch. The usual way of working is to just keep updating your fork's branch, until reviewers are happy and it's merged into the project's main branch. |
seems like a reasonable approach. |
@@ -147,6 +147,11 @@ def test_searchsorted(request, index_or_series_obj): | |||
# See gh-12238 | |||
obj = index_or_series_obj | |||
|
|||
if any(isinstance(x, str) for x in obj) and any(isinstance(x, int) for x in obj): |
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.
Can you just do if obj.inferred_type == "mixed"
? And everywhere below where you need to xfail this new index
@@ -248,12 +235,21 @@ def test_intersection_base(self, index): | |||
|
|||
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning") | |||
def test_union_base(self, index): | |||
if index.inferred_type in ["mixed", "mixed-integer"]: | |||
pytest.skip("Mixed-type Index not orderable; union fails") |
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.
Can you use the xfail
pattern you used above?
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.
Generally could you:
- use
index.inferred_type == "mixed
if you need special logic to handle it - use xfail over skip if you're expecting the test to fail
@mroeschke okay |
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.