Skip to content

Commit a5a0a29

Browse files
committed
TST: tests added pre GH46313
1 parent f469af7 commit a5a0a29

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/dtypes/test_dtypes.py

+12
Original file line numberDiff line numberDiff line change
@@ -1107,3 +1107,15 @@ def test_compare_complex_dtypes():
11071107

11081108
with pytest.raises(TypeError, match=msg):
11091109
df.lt(df.astype(object))
1110+
1111+
1112+
def test_categorical_of_booleans_is_boolean():
1113+
# https://github.com/pandas-dev/pandas/issues/46313
1114+
df = pd.DataFrame(
1115+
{"int_cat": [1, 2, 3], "bool_cat": [True, False, False]}, dtype="category"
1116+
)
1117+
value = df["bool_cat"].cat.categories.dtype
1118+
expected = np.dtype(np.bool_)
1119+
not_expected = np.dtype(np.object_)
1120+
assert value is expected
1121+
assert value is not not_expected

0 commit comments

Comments
 (0)