Skip to content
Prev Previous commit
Next Next commit
added test case
  • Loading branch information
SpoopyPillow committed Oct 31, 2024
commit e8c10255b3cc09f1ea7fbb44cc52ace53b62e9ae
14 changes: 14 additions & 0 deletions pandas/tests/dtypes/cast/test_can_hold_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,17 @@ def test_can_hold_element_int8_int():
assert not can_hold_element(arr, np.uint32(element))
assert not can_hold_element(arr, np.int64(element))
assert not can_hold_element(arr, np.uint64(element))


def test_can_hold_element_bool():
arr = np.array([], dtype=bool)

element = True
assert can_hold_element(arr, element)
assert can_hold_element(arr, np.array([element]))
assert can_hold_element(arr, np.array([element], dtype=object))

element = 1
assert not can_hold_element(arr, element)
assert not can_hold_element(arr, np.array([element]))
assert not can_hold_element(arr, np.array([element], dtype=object))
Loading