-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TST: Fix xfails for non-box maybe_promote on integer dtypes #28864
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
185c24c
passing
jbrockmendel 1d6f37d
TST: Fix integer non-boxed xfails
jbrockmendel 0cc22ff
streamline
jbrockmendel 40414b1
troubleshoot azure
jbrockmendel e3fcf81
troubleshoot more
jbrockmendel 703542b
troubleshoot CI
jbrockmendel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -151,7 +151,17 @@ def _assert_match(result_fill_value, expected_fill_value): | |
# GH#23982/25425 require the same type in addition to equality/NA-ness | ||
res_type = type(result_fill_value) | ||
ex_type = type(expected_fill_value) | ||
assert res_type == ex_type | ||
if res_type.__name__ == "uint64": | ||
# No idea why, but these (sometimes) do not compare as equal | ||
assert ex_type.__name__ == "uint64" | ||
elif res_type.__name__ == "ulonglong": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @h-vetinari did you find a nicer way to handle these? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, I didn't have to deal with |
||
# On some builds we get this instead of np.uint64 | ||
# Note: cant check res_type.dtype.itemsize directly on numpy 1.18 | ||
assert res_type(0).itemsize == 8 | ||
assert ex_type == res_type or ex_type == np.uint64 | ||
else: | ||
# On some builds, type comparison fails, e.g. np.int32 != np.int32 | ||
assert res_type == ex_type or res_type.__name__ == ex_type.__name__ | ||
|
||
match_value = result_fill_value == expected_fill_value | ||
|
||
|
@@ -275,26 +285,6 @@ def test_maybe_promote_int_with_int(dtype, fill_value, expected_dtype, box): | |
expected_dtype = np.dtype(expected_dtype) | ||
boxed, box_dtype = box # read from parametrized fixture | ||
|
||
if not boxed: | ||
if expected_dtype == object: | ||
pytest.xfail("overflow error") | ||
if expected_dtype == "int32": | ||
pytest.xfail("always upcasts to platform int") | ||
if dtype == "int8" and expected_dtype == "int16": | ||
pytest.xfail("casts to int32 instead of int16") | ||
if ( | ||
issubclass(dtype.type, np.unsignedinteger) | ||
and np.iinfo(dtype).max < fill_value <= np.iinfo("int64").max | ||
): | ||
pytest.xfail("falsely casts to signed") | ||
if (dtype, expected_dtype) in [ | ||
("uint8", "int16"), | ||
("uint32", "int64"), | ||
] and fill_value != np.iinfo("int32").min - 1: | ||
pytest.xfail("casts to int32 instead of int8/int16") | ||
# this following xfail is "only" a consequence of the - now strictly | ||
# enforced - principle that maybe_promote_with_scalar always casts | ||
pytest.xfail("wrong return type of fill_value") | ||
if boxed: | ||
if expected_dtype != object: | ||
pytest.xfail("falsely casts to object") | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I believe this is numpy/numpy#12525 and related issues