Skip to content

Commit 84db471

Browse files
committed
extra test
1 parent dc715de commit 84db471

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tests/test_encoders.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ def test_handle_unknown_error(self):
149149
def test_handle_missing_error(self):
150150
non_null = pd.DataFrame({'city': ['chicago', 'los angeles'], 'color': ['red', np.nan]}) # only 'city' column is going to be transformed
151151
has_null = pd.DataFrame({'city': ['chicago', np.nan], 'color': ['red', np.nan]})
152+
has_null_pd = pd.DataFrame({'city': ['chicago', pd.NA], 'color': ['red', pd.NA]}, dtype="string")
152153
y = pd.Series([1, 0])
153154

154155
for encoder_name in (set(encoders.__all__) - {'HashingEncoder'}): # HashingEncoder supports new values by design -> excluded
@@ -158,6 +159,9 @@ def test_handle_missing_error(self):
158159
with self.assertRaises(ValueError):
159160
enc.fit(has_null, y)
160161

162+
with self.assertRaises(ValueError):
163+
enc.fit(has_null_pd, y)
164+
161165
enc.fit(non_null, y) # we raise an error only if a missing value is in one of the transformed columns
162166

163167
with self.assertRaises(ValueError):

0 commit comments

Comments
 (0)