Skip to content

Commit d8a6238

Browse files
committed
Add failing test for empty boolean Categoricals
1 parent 6da5a72 commit d8a6238

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/arrays/categorical/test_constructors.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ def test_constructor_empty(self):
4242
expected = pd.Int64Index([1, 2, 3])
4343
tm.assert_index_equal(c.categories, expected)
4444

45+
@pytest.mark.xfail
46+
def test_constructor_empty_boolean(self):
47+
# see gh-22702
48+
cat = pd.CategoricalIndex([], categories=[True, False])
49+
categories = sorted(cat.categories.tolist())
50+
assert categories == [False, True]
51+
4552
def test_constructor_tuples(self):
4653
values = np.array([(1,), (1, 2), (1,), (1, 2)], dtype=object)
4754
result = Categorical(values)

0 commit comments

Comments
 (0)