@@ -151,7 +151,17 @@ def _assert_match(result_fill_value, expected_fill_value):
151151 # GH#23982/25425 require the same type in addition to equality/NA-ness
152152 res_type = type (result_fill_value )
153153 ex_type = type (expected_fill_value )
154- assert res_type == ex_type
154+ if res_type .__name__ == "uint64" :
155+ # No idea why, but these (sometimes) do not compare as equal
156+ assert ex_type .__name__ == "uint64"
157+ elif res_type .__name__ == "ulonglong" :
158+ # On some builds we get this instead of np.uint64
159+ # Note: cant check res_type.dtype.itemsize directly on numpy 1.18
160+ assert res_type (0 ).itemsize == 8
161+ assert ex_type == res_type or ex_type == np .uint64
162+ else :
163+ # On some builds, type comparison fails, e.g. np.int32 != np.int32
164+ assert res_type == ex_type or res_type .__name__ == ex_type .__name__
155165
156166 match_value = result_fill_value == expected_fill_value
157167
@@ -275,26 +285,6 @@ def test_maybe_promote_int_with_int(dtype, fill_value, expected_dtype, box):
275285 expected_dtype = np .dtype (expected_dtype )
276286 boxed , box_dtype = box # read from parametrized fixture
277287
278- if not boxed :
279- if expected_dtype == object :
280- pytest .xfail ("overflow error" )
281- if expected_dtype == "int32" :
282- pytest .xfail ("always upcasts to platform int" )
283- if dtype == "int8" and expected_dtype == "int16" :
284- pytest .xfail ("casts to int32 instead of int16" )
285- if (
286- issubclass (dtype .type , np .unsignedinteger )
287- and np .iinfo (dtype ).max < fill_value <= np .iinfo ("int64" ).max
288- ):
289- pytest .xfail ("falsely casts to signed" )
290- if (dtype , expected_dtype ) in [
291- ("uint8" , "int16" ),
292- ("uint32" , "int64" ),
293- ] and fill_value != np .iinfo ("int32" ).min - 1 :
294- pytest .xfail ("casts to int32 instead of int8/int16" )
295- # this following xfail is "only" a consequence of the - now strictly
296- # enforced - principle that maybe_promote_with_scalar always casts
297- pytest .xfail ("wrong return type of fill_value" )
298288 if boxed :
299289 if expected_dtype != object :
300290 pytest .xfail ("falsely casts to object" )
0 commit comments