Skip to content

Commit 01c8f2d

Browse files
committed
TST: Add test for categorical with str and tuples
The bug is not present any more. closes #21416
1 parent ad3280e commit 01c8f2d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pandas/tests/arrays/categorical/test_constructors.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,3 +601,9 @@ def test_constructor_imaginary(self):
601601
c1 = Categorical(values)
602602
tm.assert_index_equal(c1.categories, Index(values))
603603
tm.assert_numpy_array_equal(np.array(c1), np.array(values))
604+
605+
def test_constructor_string_and_tuples(self):
606+
#GH 21416
607+
c = pd.Categorical(['c', ('a', 'b'), ('b', 'a'), 'c'])
608+
expected_index = pd.Index([('a', 'b'), ('b', 'a'), 'c'])
609+
assert c.categories.equals(expected_index)

0 commit comments

Comments
 (0)