|
18 | 18 | from pandas._libs import iNaT, lib, missing as libmissing
|
19 | 19 | import pandas.util._test_decorators as td
|
20 | 20 |
|
| 21 | +from pandas.core.arrays import IntegerArray |
21 | 22 | from pandas.core.dtypes import inference
|
22 | 23 | from pandas.core.dtypes.common import (
|
23 | 24 | ensure_categorical,
|
@@ -552,14 +553,19 @@ def test_maybe_convert_objects_datetime(self):
|
552 | 553 | out = lib.maybe_convert_objects(arr, convert_datetime=1, convert_timedelta=1)
|
553 | 554 | tm.assert_numpy_array_equal(out, exp)
|
554 | 555 |
|
555 |
| - def test_maybe_convert_objects_nullable_integer(self): |
| 556 | + @pytest.mark.parametrize( |
| 557 | + "exp", |
| 558 | + [ |
| 559 | + IntegerArray(np.array([2, 0], dtype="i8"), np.array([False, True])), |
| 560 | + IntegerArray(np.array([2, 0], dtype="int64"), np.array([False, True])), |
| 561 | + ], |
| 562 | + ) |
| 563 | + def test_maybe_convert_objects_nullable_integer(self, exp): |
556 | 564 | # GH27335
|
557 | 565 | arr = np.array([2, np.NaN], dtype=object)
|
558 | 566 | result = lib.maybe_convert_objects(arr, convert_to_nullable_integer=1)
|
559 |
| - from pandas.core.arrays import IntegerArray |
560 | 567 |
|
561 |
| - exp = IntegerArray(np.array([2, 0], dtype="i8"), np.array([False, True])) |
562 |
| - tm.assert_equal(result, exp) |
| 568 | + tm.assert_extension_array_equal(result, exp) |
563 | 569 |
|
564 | 570 | def test_mixed_dtypes_remain_object_array(self):
|
565 | 571 | # GH14956
|
|
0 commit comments