Skip to content

Commit 5272751

Browse files
committed
test casting safety
1 parent 7285238 commit 5272751

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

stringdtype/tests/test_stringdtype.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,12 @@ def test_integer_casts(dtype, bitsize, signed):
387387
ainp = np.array(inp, dtype=idtype)
388388
np.testing.assert_array_equal(ainp, ainp.astype(dtype).astype(idtype))
389389

390+
with pytest.raises(TypeError):
391+
ainp.astype(dtype, casting="safe")
392+
393+
with pytest.raises(TypeError):
394+
ainp.astype(dtype).astype(idtype, casting="safe")
395+
390396
oob = [str(2**bitsize), str(-(2**bitsize))]
391397
with pytest.raises(OverflowError):
392398
np.array(oob, dtype=dtype).astype(idtype)

0 commit comments

Comments
 (0)