Skip to content

Commit 7323d19

Browse files
authored
TST: GH30999 add msg to pytest.raises in simple cases where modules have 1 instance (#38805)
1 parent fdc2585 commit 7323d19

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

pandas/tests/dtypes/test_inference.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ def foo():
131131
inference.is_list_like([])
132132
foo()
133133

134-
with pytest.raises(RecursionError):
134+
with tm.external_error_raised(RecursionError):
135135
foo()
136136

137137

pandas/tests/libs/test_hashtable.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ def test_get_set_contains_len(self, table_type, dtype):
6969
assert table.get_item(index + 1) == 41
7070
assert index + 2 not in table
7171

72-
with pytest.raises(KeyError) as excinfo:
72+
with pytest.raises(KeyError, match=str(index + 2)):
7373
table.get_item(index + 2)
74-
assert str(index + 2) in str(excinfo.value)
7574

7675
def test_map(self, table_type, dtype):
7776
# PyObjectHashTable has no map-method

pandas/tests/resample/test_resampler_grouper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def test_groupby_with_origin():
151151
count_ts = ts.groupby(simple_grouper).agg("count")
152152
count_ts = count_ts[middle:end]
153153
count_ts2 = ts2.groupby(simple_grouper).agg("count")
154-
with pytest.raises(AssertionError):
154+
with pytest.raises(AssertionError, match="Index are different"):
155155
tm.assert_index_equal(count_ts.index, count_ts2.index)
156156

157157
# test origin on 1970-01-01 00:00:00

0 commit comments

Comments
 (0)