Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
stanmart committed Jan 23, 2024
1 parent 1618707 commit c448f3d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tests/glm/test_glm.py
Original file line number Diff line number Diff line change
Expand Up @@ -3209,11 +3209,8 @@ def test_cat_missing(cat_missing_method, unseen_missing, formula):
formula=formula,
fit_intercept=False,
)
if cat_missing_method == "convert" and formula:
with pytest.raises(NotImplementedError):
model.fit(X, y)
elif cat_missing_method == "fail" and not unseen_missing:
with pytest.raises(ValueError):
if cat_missing_method == "fail" and not unseen_missing:
with pytest.raises(ValueError, match="Categorical data can't have missing values"):
model.fit(X, y)
else:
model.fit(X, y)
Expand All @@ -3227,7 +3224,10 @@ def test_cat_missing(cat_missing_method, unseen_missing, formula):
assert len(model.coef_) == len(feature_names)

if cat_missing_method == "fail" and unseen_missing:
with pytest.raises(ValueError):
with pytest.raises(ValueError, match="Categorical data can't have missing values"):
model.predict(X_unseen)
elif cat_missing_method == "convert" and unseen_missing:
with pytest.raises(ValueError, match="contains unseen categories"):
model.predict(X_unseen)
else:
model.predict(X_unseen)

0 comments on commit c448f3d

Please sign in to comment.