Skip to content

Commit 975de26

Browse files
author
Daniel Saxton
committed
Parametrize test
1 parent 482d629 commit 975de26

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/tests/dtypes/test_common.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,11 @@ def test__is_dtype_type_sparse():
734734
assert com._is_dtype_type(ser.dtype, lambda tipo: tipo == result)
735735

736736

737-
def test__nansafe_nat_to_int():
738-
arr = np.array([np.datetime64("NaT")])
737+
@pytest.mark.parametrize("val", [np.datetime64("NaT")])
738+
@pytest.mark.parametrize("typ", [np.int8, np.int16, np.int32, np.int64])
739+
def test_astype_nansafe(val, typ):
740+
arr = np.array([val])
739741

740742
msg = "Cannot convert NaT values to integer"
741743
with pytest.raises(ValueError, match=msg):
742-
astype_nansafe(arr, dtype=np.int64)
744+
astype_nansafe(arr, dtype=typ)

0 commit comments

Comments
 (0)