Skip to content

Commit 4a5ea0d

Browse files
committed
Fix: Update error messages in exception tests to allow for varying pandas DataFrame representations
1 parent 2f3883e commit 4a5ea0d

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

doubleml/irm/tests/test_apo_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def test_apo_exception_data():
2525
msg = (
2626
r"The data must be of DoubleMLData or DoubleMLClusterData or DoubleMLDIDData or DoubleMLSSMData or "
2727
r"DoubleMLRDDData type\. Empty DataFrame\nColumns: \[\]\nIndex: \[\] of type "
28-
r"<class 'pandas\.DataFrame'> was passed\."
28+
r"<class 'pandas\..*DataFrame'> was passed\."
2929
)
3030
with pytest.raises(TypeError, match=msg):
3131
_ = DoubleMLAPO(pd.DataFrame(), ml_g, ml_m, treatment_level=0)

doubleml/irm/tests/test_ssm_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def test_ssm_exception_data():
3535
msg = (
3636
r"The data must be of DoubleMLData or DoubleMLClusterData or DoubleMLDIDData or DoubleMLSSMData or "
3737
r"DoubleMLRDDData type\. Empty DataFrame\nColumns: \[\]\nIndex: \[\] of type "
38-
r"<class 'pandas\.DataFrame'> was passed\."
38+
r"<class 'pandas\..*DataFrame'> was passed\."
3939
)
4040
with pytest.raises(TypeError, match=msg):
4141
_ = DoubleMLSSM(pd.DataFrame(), ml_g, ml_pi, ml_m)

doubleml/plm/tests/test_plpr_exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161

6262
@pytest.mark.ci
6363
def test_plpr_exception_data():
64-
msg = "The data must be of DoubleMLPanelData type. <class 'pandas.DataFrame'> was passed."
64+
msg = r"The data must be of DoubleMLPanelData type. <class 'pandas\..*DataFrame'> was passed."
6565
with pytest.raises(TypeError, match=msg):
6666
_ = dml.DoubleMLPLPR(pd.DataFrame(), ml_l, ml_m)
6767
# not a panel data object

doubleml/utils/tests/test_policytree.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ def test_doubleml_exception_policytree():
9898
with pytest.raises(TypeError, match=msg):
9999
dml_policytree_predict.predict(features=1)
100100
msg = (
101-
r"The features must have the keys Index\(\[\'a\', \'b\', \'c\'\], dtype\=\'str\'\). "
102-
r"Features with keys Index\(\[\'d\'\], dtype=\'str\'\) were passed."
101+
r"The features must have the keys Index\(\[\'a\', \'b\', \'c\'\], dtype=.*?\)\. "
102+
r"Features with keys Index\(\[\'d\'\], dtype=.*?\) were passed\."
103103
)
104104
with pytest.raises(KeyError, match=msg):
105105
dml_policytree_predict.predict(features=pd.DataFrame({"d": [3, 4]}))

0 commit comments

Comments
 (0)