@@ -54,12 +54,20 @@ def generate_binary_data():
5454def test_dml_plr_binary_warnings (generate_binary_data , learner_binary , score ):
5555 data = generate_binary_data
5656 obj_dml_data = dml .DoubleMLData (data , "y" , ["d" ])
57- msg = "The ml_m learner {str(ml_m)} was identified as classifier ' \
58- 'but at least one treatment variable is not binary with values 0 and 1.'"
57+ msg = "The ml_l learner {str(ml_l)} was identified as classifier"
5958 with pytest .warns (UserWarning , match = msg ):
6059 _ = dml .DoubleMLPLR (obj_dml_data , clone (learner_binary ), clone (learner_binary ), score = score )
6160
6261
62+ @pytest .mark .ci
63+ def test_dml_plr_binary_exceptions (generate_binary_data , learner_binary , score ):
64+ data = generate_binary_data
65+ obj_dml_data = dml .DoubleMLData (data , "X1" , ["d" ])
66+ msg = "The ml_l learner .+ was identified as classifier but the outcome variable is not binary with values 0 and 1."
67+ with pytest .raises (ValueError , match = msg ):
68+ _ = dml .DoubleMLPLR (obj_dml_data , clone (learner_binary ), clone (learner_binary ), score = score )
69+
70+
6371@pytest .fixture (scope = "module" )
6472def dml_plr_binary_fixture (generate_binary_data , learner_binary , score ):
6573 boot_methods = ["normal" ]
0 commit comments