Skip to content

Commit 4e79246

Browse files
arw2019Kevin D Smith
authored and
Kevin D Smith
committed
TST: examples from OP (pandas-dev#37090)
1 parent ce7678e commit 4e79246

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pandas/tests/series/test_constructors.py

+7
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,13 @@ def test_constructor_coerce_float_valid(self, float_dtype):
689689
expected = Series([1, 2, 3.5]).astype(float_dtype)
690690
tm.assert_series_equal(s, expected)
691691

692+
def test_constructor_invalid_coerce_ints_with_float_nan(self, any_int_dtype):
693+
# GH 22585
694+
695+
msg = "cannot convert float NaN to integer"
696+
with pytest.raises(ValueError, match=msg):
697+
pd.Series([1, 2, np.nan], dtype=any_int_dtype)
698+
692699
def test_constructor_dtype_no_cast(self):
693700
# see gh-1572
694701
s = Series([1, 2, 3])

0 commit comments

Comments
 (0)