Skip to content

Commit b76bdaf

Browse files
committed
Update test_qte_exceptions.py
1 parent 9b08a91 commit b76bdaf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

doubleml/irm/tests/test_qte_exceptions.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,3 +133,23 @@ def test_doubleml_exception_confint():
133133
dml_qte_confint.bootstrap()
134134
df_qte_ci = dml_qte_confint.confint(joint=True)
135135
assert isinstance(df_qte_ci, pd.DataFrame)
136+
137+
138+
@pytest.mark.ci
139+
def test_doubleml_exception_p_adjust():
140+
dml_qte_p_adjust = DoubleMLQTE(dml_data_irm, RandomForestClassifier(), RandomForestClassifier())
141+
142+
msg = r'Apply fit\(\) before p_adjust\(\).'
143+
with pytest.raises(ValueError, match=msg):
144+
dml_qte_p_adjust.p_adjust()
145+
dml_qte_p_adjust.fit()
146+
msg = r'Apply bootstrap\(\) before p_adjust\("romano-wolf"\).'
147+
with pytest.raises(ValueError, match=msg):
148+
dml_qte_p_adjust.p_adjust(method='romano-wolf')
149+
dml_qte_p_adjust.bootstrap()
150+
p_val = dml_qte_p_adjust.p_adjust(method='romano-wolf')
151+
assert isinstance(p_val, pd.DataFrame)
152+
153+
msg = "The p_adjust method must be of str type. 0.05 of type <class 'float'> was passed."
154+
with pytest.raises(TypeError, match=msg):
155+
dml_qte_p_adjust.p_adjust(method=0.05)

0 commit comments

Comments
 (0)