Skip to content

Commit 304209f

Browse files
authored
Added pd.NA to nulls_fixture (#31799)
1 parent 60b8f05 commit 304209f

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

pandas/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ def other_closed(request):
441441
return request.param
442442

443443

444-
@pytest.fixture(params=[None, np.nan, pd.NaT, float("nan"), np.float("NaN")])
444+
@pytest.fixture(params=[None, np.nan, pd.NaT, float("nan"), np.float("NaN"), pd.NA])
445445
def nulls_fixture(request):
446446
"""
447447
Fixture for each null type in pandas.

pandas/tests/arithmetic/test_interval.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,10 @@ def test_compare_scalar_interval_mixed_closed(self, op, closed, other_closed):
129129
def test_compare_scalar_na(self, op, array, nulls_fixture):
130130
result = op(array, nulls_fixture)
131131
expected = self.elementwise_comparison(op, array, nulls_fixture)
132+
133+
if nulls_fixture is pd.NA and array.dtype != pd.IntervalDtype("int"):
134+
pytest.xfail("broken for non-integer IntervalArray; see GH 31882")
135+
132136
tm.assert_numpy_array_equal(result, expected)
133137

134138
@pytest.mark.parametrize(
@@ -207,6 +211,10 @@ def test_compare_list_like_nan(self, op, array, nulls_fixture):
207211
other = [nulls_fixture] * 4
208212
result = op(array, other)
209213
expected = self.elementwise_comparison(op, array, other)
214+
215+
if nulls_fixture is pd.NA:
216+
pytest.xfail("broken for non-integer IntervalArray; see GH 31882")
217+
210218
tm.assert_numpy_array_equal(result, expected)
211219

212220
@pytest.mark.parametrize(

pandas/tests/indexes/multi/test_indexing.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,10 @@ def test_get_loc_nan(level, nulls_fixture):
384384
key = ["b", "d"]
385385
levels[level] = np.array([0, nulls_fixture], dtype=type(nulls_fixture))
386386
key[level] = nulls_fixture
387+
388+
if nulls_fixture is pd.NA:
389+
pytest.xfail("MultiIndex from pd.NA in np.array broken; see GH 31883")
390+
387391
idx = MultiIndex.from_product(levels)
388392
assert idx.get_loc(tuple(key)) == 3
389393

pandas/tests/indexes/test_base.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ def test_index_ctor_infer_nat_dt_like(self, pos, klass, dtype, ctor, nulls_fixtu
305305
data = [ctor]
306306
data.insert(pos, nulls_fixture)
307307

308+
if nulls_fixture is pd.NA:
309+
expected = Index([pd.NA, pd.NaT])
310+
pytest.xfail("Broken with np.NaT ctor; see GH 31884")
311+
308312
result = Index(data)
309313
tm.assert_index_equal(result, expected)
310314

@@ -1964,6 +1968,9 @@ def test_isin_nan_common_float64(self, nulls_fixture):
19641968
pytest.skip("pd.NaT not compatible with Float64Index")
19651969

19661970
# Float64Index overrides isin, so must be checked separately
1971+
if nulls_fixture is pd.NA:
1972+
pytest.xfail("Float64Index cannot contain pd.NA")
1973+
19671974
tm.assert_numpy_array_equal(
19681975
Float64Index([1.0, nulls_fixture]).isin([np.nan]), np.array([False, True])
19691976
)

0 commit comments

Comments
 (0)