Skip to content

Commit

Permalink
TST: Updated with match (#24707)
Browse files Browse the repository at this point in the history
  • Loading branch information
rajibmitra authored and TomAugspurger committed Jan 16, 2019
1 parent 5a15a37 commit b99f8bc
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pandas/tests/io/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@ def test_excel_read_buffer(self, ext):

def test_bad_engine_raises(self, ext):
bad_engine = 'foo'
with pytest.raises(ValueError, message="Unknown engine: foo"):
with pytest.raises(ValueError, match="Unknown engine: foo"):
read_excel('', engine=bad_engine)

@tm.network
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3923,7 +3923,7 @@ def test_read_column(self):
# HDFStore.select_column should raise a KeyError
# exception if the key is not a valid store
with pytest.raises(KeyError,
message='No object named index in the file'):
match='No object named df in the file'):
store.select_column('df', 'index')

store.append('df', df)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/scalar/timestamp/test_unary_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def test_round_dst_border_nonexistent(self, method, ts_str, freq):
assert result is NaT

with pytest.raises(pytz.NonExistentTimeError,
message='2018-03-11 02:00:00'):
match='2018-03-11 02:00:00'):
getattr(ts, method)(freq, nonexistent='raise')

@pytest.mark.parametrize('timestamp', [
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/series/test_datetime_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ def test_dt_round_tz_nonexistent(self, method, ts_str, freq):
tm.assert_series_equal(result, expected)

with pytest.raises(pytz.NonExistentTimeError,
message='2018-03-11 02:00:00'):
match='2018-03-11 02:00:00'):
getattr(s.dt, method)(freq, nonexistent='raise')

def test_dt_namespace_accessor_categorical(self):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/sparse/frame/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ def test_constructor_from_unknown_type(self):
class Unknown(object):
pass
with pytest.raises(TypeError,
message='SparseDataFrame called with unknown type '
'"Unknown" for data argument'):
match=('SparseDataFrame called with unknown type '
'"Unknown" for data argument')):
SparseDataFrame(Unknown())

def test_constructor_preserve_attr(self):
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ def test_deprecate_option(self):
warnings.simplefilter('always')
with pytest.raises(
KeyError,
message="Nonexistent option didn't raise KeyError"):
match="No such keys.s.: 'foo'"):
self.cf.get_option('foo')
assert len(w) == 1 # should have raised one warning
assert 'deprecated' in str(w[-1]) # we get the default message
Expand Down

0 comments on commit b99f8bc

Please sign in to comment.