Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
TST: tests added pre GH46313
  • Loading branch information
rxd330 committed Mar 18, 2022
commit a5a0a29dbb5e2ffb7af4cfe3c295fe00dceeed18
12 changes: 12 additions & 0 deletions pandas/tests/dtypes/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,3 +1107,15 @@ def test_compare_complex_dtypes():

with pytest.raises(TypeError, match=msg):
df.lt(df.astype(object))


def test_categorical_of_booleans_is_boolean():
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is unrelated, please merge master

# https://github.com/pandas-dev/pandas/issues/46313
df = pd.DataFrame(
{"int_cat": [1, 2, 3], "bool_cat": [True, False, False]}, dtype="category"
)
value = df["bool_cat"].cat.categories.dtype
expected = np.dtype(np.bool_)
not_expected = np.dtype(np.object_)
assert value is expected
assert value is not not_expected