Skip to content
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

TST: restore type checks to maybe_promote tests #28561

Closed
wants to merge 3 commits into from

Conversation

jbrockmendel
Copy link
Member

xref #25425. Working on fixing the xfailed tests in this file. This is going to be a marathon.

@h-vetinari
Copy link
Contributor

Very cool - I didn't expect that the typecheck could be re-introduced so easily. Thanks for tackling this!

OTOH, most of worst tests of #23982 were turned into dummies for #25637. As I offered, I can rebase #23982, so we have the same baseline of tests available (somewhere outside #25424).

@gfyoung gfyoung added Dtype Conversions Unexpected or buggy dtype conversions Testing pandas testing functions or related to the test suite labels Sep 22, 2019
pandas/core/dtypes/cast.py Outdated Show resolved Hide resolved
casted = dtype.type(value)
if casted == value:
return True
return False
Copy link
Member

Choose a reason for hiding this comment

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

Why not just return dtype.type(value) == value ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Either way would work. I think in future steps this function is going to have to check a couple more things.

Co-Authored-By: gfyoung <gfyoung17+GitHub@gmail.com>
@@ -366,6 +367,8 @@ def maybe_promote(dtype, fill_value=np.nan):
elif is_bool(fill_value):
if not issubclass(dtype.type, np.bool_):
dtype = np.object_
else:
fill_value = np.bool_(fill_value)
Copy link
Contributor

Choose a reason for hiding this comment

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

you added some code here but are these actually hit?

Copy link
Contributor

Choose a reason for hiding this comment

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

i see you have another PR on top; can you just do them in one

Copy link
Member Author

Choose a reason for hiding this comment

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

you added some code here but are these actually hit?

Yes. All the changes to the non-test code are needed to make the changes in the test code pass.

Copy link
Member Author

Choose a reason for hiding this comment

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

i see you have another PR on top; can you just do them in one

Sure. Just close this and move conversation there?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah let's just do it in one

@jbrockmendel
Copy link
Member Author

Closing in favor of #28564.

@jbrockmendel jbrockmendel deleted the maybe_promote2 branch September 23, 2019 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dtype Conversions Unexpected or buggy dtype conversions 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