Skip to content

Commit 8875602

Browse files
committed
added a unit test for the new warning (see db74e05)
1 parent 8eb4de7 commit 8875602

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

doubleml/tests/test_doubleml_exceptions.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,10 @@ def test_doubleml_exception_learner():
492492
with pytest.warns(UserWarning, match=msg):
493493
_ = DoubleMLPLR(dml_data, ml_l=Lasso(), ml_m=ml_m, score='IV-type')
494494

495+
msg = 'A learner ml_g has been provided for score = "partialling out" but will be ignored.'
496+
with pytest.warns(UserWarning, match=msg):
497+
_ = DoubleMLPLR(dml_data, ml_l=Lasso(), ml_m=Lasso(), ml_g=Lasso(), score='partialling out')
498+
495499
msg = 'ml_g was renamed to ml_l'
496500
with pytest.warns(DeprecationWarning, match=msg):
497501
_ = DoubleMLPLIV(dml_data_pliv, ml_g=Lasso(), ml_m=ml_m, ml_r=ml_r) # pylint: disable=no-value-for-parameter
@@ -501,6 +505,10 @@ def test_doubleml_exception_learner():
501505
_ = DoubleMLPLIV(dml_data_pliv, ml_l=ml_l, ml_m=ml_m, ml_r=ml_r,
502506
score='IV-type')
503507

508+
msg = 'A learner ml_g has been provided for score = "partialling out" but will be ignored.'
509+
with pytest.warns(UserWarning, match=msg):
510+
_ = DoubleMLPLIV(dml_data_pliv, ml_l=Lasso(), ml_m=Lasso(), ml_r=Lasso(), ml_g=Lasso(), score='partialling out')
511+
504512
# we allow classifiers for ml_g for binary treatment variables in IRM
505513
msg = (r'The ml_g learner LogisticRegression\(\) was identified as classifier '
506514
'but the outcome variable is not binary with values 0 and 1.')

0 commit comments

Comments
 (0)