Skip to content

Commit 062d281

Browse files
committed
use parameterization
1 parent e605559 commit 062d281

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pandas/tests/frame/test_dtypes.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -815,7 +815,8 @@ def test_astype_extension_dtypes_duplicate_col(self, dtype):
815815
expected = concat([a1.astype(dtype), a2.astype(dtype)], axis=1)
816816
tm.assert_frame_equal(result, expected)
817817

818-
def test_df_where_with_category(self):
818+
@pytest.mark.parametrize("kwargs", [dict(), dict(other=None)])
819+
def test_df_where_with_category(self, kwargs):
819820
# GH 16979
820821
df = DataFrame(np.arange(2 * 3).reshape(2, 3), columns=list("ABC"))
821822
mask = np.array([[True, False, True], [False, True, True]])
@@ -824,8 +825,8 @@ def test_df_where_with_category(self):
824825
df.B = df.B.astype("category")
825826
df.C = df.C.astype("category")
826827

827-
expected = df.A.where(mask[:, 0])
828-
result = df.A.where(mask[:, 0], other=None)
828+
result = df.A.where(mask[:, 0], **kwargs)
829+
expected = Series(pd.Categorical([0, np.nan], categories=[0, 3]), name="A")
829830
tm.assert_series_equal(result, expected)
830831

831832
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)