Skip to content

Commit c24de12

Browse files
committed
Parameterize test and use assert_extension_array_equal instead of assert_equal
1 parent 7672fa6 commit c24de12

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pandas/tests/dtypes/test_inference.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from pandas._libs import iNaT, lib, missing as libmissing
1919
import pandas.util._test_decorators as td
2020

21+
from pandas.core.arrays import IntegerArray
2122
from pandas.core.dtypes import inference
2223
from pandas.core.dtypes.common import (
2324
ensure_categorical,
@@ -552,14 +553,19 @@ def test_maybe_convert_objects_datetime(self):
552553
out = lib.maybe_convert_objects(arr, convert_datetime=1, convert_timedelta=1)
553554
tm.assert_numpy_array_equal(out, exp)
554555

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):
556564
# GH27335
557565
arr = np.array([2, np.NaN], dtype=object)
558566
result = lib.maybe_convert_objects(arr, convert_to_nullable_integer=1)
559-
from pandas.core.arrays import IntegerArray
560567

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)
563569

564570
def test_mixed_dtypes_remain_object_array(self):
565571
# GH14956

0 commit comments

Comments
 (0)