Skip to content

Commit 952114f

Browse files
author
Daniel Saxton
committed
Parametrize test
1 parent 9dd2dbe commit 952114f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

pandas/tests/extension/test_categorical.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,12 @@ def test_searchsorted(self, data_for_sorting):
197197

198198

199199
class TestCasting(base.BaseCastingTests):
200-
def test_cast_nan_to_int(self):
201-
s1 = pd.Series([0, 1, np.nan], dtype="category")
202-
s2 = pd.Series([0, 1, np.inf], dtype="category")
200+
@pytest.mark.parametrize("value", [np.nan, -np.inf, np.inf])
201+
def test_cast_nan_to_int(self, value):
202+
s = pd.Series([0, 1, value], dtype="category")
203203

204204
with pytest.raises(ValueError):
205-
s1.astype(int)
206-
with pytest.raises(ValueError):
207-
s2.astype(int)
205+
s.astype(int)
208206

209207

210208
class TestArithmeticOps(base.BaseArithmeticOpsTests):

0 commit comments

Comments
 (0)