Skip to content

Commit ee438e0

Browse files
jbrockmendelproost
authored andcommitted
TST: fix 9 xfails (pandas-dev#28776)
1 parent 884425b commit ee438e0

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

pandas/core/dtypes/cast.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,9 @@ def maybe_promote(dtype, fill_value=np.nan):
375375
if issubclass(dtype.type, np.bool_):
376376
dtype = np.object_
377377
elif issubclass(dtype.type, np.integer):
378-
dtype = np.float64
378+
dtype = np.dtype(np.float64)
379+
if not isna(fill_value):
380+
fill_value = dtype.type(fill_value)
379381
elif is_bool(fill_value):
380382
if not issubclass(dtype.type, np.bool_):
381383
dtype = np.object_

pandas/tests/dtypes/cast/test_promote.py

-3
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ def test_maybe_promote_int_with_float(any_int_dtype, float_dtype, box):
174174
fill_dtype = np.dtype(float_dtype)
175175
boxed, box_dtype = box # read from parametrized fixture
176176

177-
if float_dtype == "float32" and not boxed:
178-
pytest.xfail("falsely upcasts to float64")
179-
180177
# create array of given dtype; casts "1" to correct dtype
181178
fill_value = np.array([1], dtype=fill_dtype)[0]
182179

0 commit comments

Comments
 (0)