Skip to content

Commit a4b0132

Browse files
jbrockmendelTomAugspurger
authored andcommitted
TST: fix flaky xfail (#28016)
* TST: fix flaky xfail
1 parent fb62fcf commit a4b0132

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pandas/tests/series/test_analytics.py

+9-10
Original file line numberDiff line numberDiff line change
@@ -1482,23 +1482,18 @@ def test_value_counts_with_nan(self):
14821482

14831483
@pytest.mark.parametrize(
14841484
"dtype",
1485-
[
1486-
"int_",
1487-
"uint",
1488-
"float_",
1489-
"unicode_",
1490-
"timedelta64[h]",
1491-
pytest.param(
1492-
"datetime64[D]", marks=pytest.mark.xfail(reason="GH#7996", strict=True)
1493-
),
1494-
],
1485+
["int_", "uint", "float_", "unicode_", "timedelta64[h]", "datetime64[D]"],
14951486
)
14961487
def test_drop_duplicates_categorical_non_bool(self, dtype, ordered_fixture):
14971488
cat_array = np.array([1, 2, 3, 4, 5], dtype=np.dtype(dtype))
14981489

14991490
# Test case 1
15001491
input1 = np.array([1, 2, 3, 3], dtype=np.dtype(dtype))
15011492
tc1 = Series(Categorical(input1, categories=cat_array, ordered=ordered_fixture))
1493+
if dtype == "datetime64[D]":
1494+
# pre-empty flaky xfail, tc1 values are seemingly-random
1495+
if not (np.array(tc1) == input1).all():
1496+
pytest.xfail(reason="GH#7996")
15021497

15031498
expected = Series([False, False, False, True])
15041499
tm.assert_series_equal(tc1.duplicated(), expected)
@@ -1524,6 +1519,10 @@ def test_drop_duplicates_categorical_non_bool(self, dtype, ordered_fixture):
15241519
# Test case 2
15251520
input2 = np.array([1, 2, 3, 5, 3, 2, 4], dtype=np.dtype(dtype))
15261521
tc2 = Series(Categorical(input2, categories=cat_array, ordered=ordered_fixture))
1522+
if dtype == "datetime64[D]":
1523+
# pre-empty flaky xfail, tc2 values are seemingly-random
1524+
if not (np.array(tc2) == input2).all():
1525+
pytest.xfail(reason="GH#7996")
15271526

15281527
expected = Series([False, False, False, False, True, True, False])
15291528
tm.assert_series_equal(tc2.duplicated(), expected)

0 commit comments

Comments
 (0)