Skip to content

Commit

Permalink
TST: GH30999 Change all pytest.raises in pandas/tests/indexing to tm.…
Browse files Browse the repository at this point in the history
…external_error_raised (#38825)
  • Loading branch information
moink authored Dec 31, 2020
1 parent 784de76 commit dd52445
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pandas/tests/indexing/multiindex/test_partial.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ def test_partial_loc_missing(self, multiindex_year_month_day_dataframe_random_da
# assert (self.ymd.loc[2000]['A'] == 0).all()

# Pretty sure the second (and maybe even the first) is already wrong.
with pytest.raises(Exception):
with pytest.raises(KeyError, match="6"):
ymd.loc[(2000, 6)]
with pytest.raises(Exception):
with pytest.raises(KeyError, match="(2000, 6)"):
ymd.loc[(2000, 6), 0]

# ---------------------------------------------------------------------
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/indexing/test_coercion.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ def test_setitem_index_float64(self, val, exp_dtype, request):
if exp_dtype is IndexError:
# float + int -> int
temp = obj.copy()
with pytest.raises(exp_dtype):
msg = "index 5 is out of bounds for axis 0 with size 4"
with pytest.raises(exp_dtype, match=msg):
temp[5] = 5
mark = pytest.mark.xfail(reason="TODO_GH12747 The result must be float")
request.node.add_marker(mark)
Expand Down

0 comments on commit dd52445

Please sign in to comment.