Skip to content

Commit df0c849

Browse files
author
MarcoGorelli
committed
avoid upcast
1 parent 042ebab commit df0c849

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pandas/tests/arrays/masked_shared.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ def _compare_other(self, data, op, other):
2424
ser = pd.Series(data)
2525
result = op(ser, other)
2626

27-
expected = op(pd.Series(data._data), other)
27+
# Set nullable dtype here to avoid upcasting when setting to pd.NA below
28+
expected = op(pd.Series(data._data), other).astype("boolean")
2829

2930
# fill the nan locations
3031
expected[data._mask] = pd.NA
31-
expected = expected.astype("boolean")
32+
expected = expected
3233

3334
tm.assert_series_equal(result, expected)
3435

0 commit comments

Comments
 (0)