Skip to content

Commit b99f8bc

Browse files
rajibmitraTomAugspurger
authored andcommitted
TST: Updated with match (#24707)
1 parent 5a15a37 commit b99f8bc

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

pandas/tests/io/test_excel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -698,7 +698,7 @@ def test_excel_read_buffer(self, ext):
698698

699699
def test_bad_engine_raises(self, ext):
700700
bad_engine = 'foo'
701-
with pytest.raises(ValueError, message="Unknown engine: foo"):
701+
with pytest.raises(ValueError, match="Unknown engine: foo"):
702702
read_excel('', engine=bad_engine)
703703

704704
@tm.network

pandas/tests/io/test_pytables.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3923,7 +3923,7 @@ def test_read_column(self):
39233923
# HDFStore.select_column should raise a KeyError
39243924
# exception if the key is not a valid store
39253925
with pytest.raises(KeyError,
3926-
message='No object named index in the file'):
3926+
match='No object named df in the file'):
39273927
store.select_column('df', 'index')
39283928

39293929
store.append('df', df)

pandas/tests/scalar/timestamp/test_unary_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def test_round_dst_border_nonexistent(self, method, ts_str, freq):
171171
assert result is NaT
172172

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

177177
@pytest.mark.parametrize('timestamp', [

pandas/tests/series/test_datetime_values.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def test_dt_round_tz_nonexistent(self, method, ts_str, freq):
300300
tm.assert_series_equal(result, expected)
301301

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

306306
def test_dt_namespace_accessor_categorical(self):

pandas/tests/sparse/frame/test_frame.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ def test_constructor_from_unknown_type(self):
216216
class Unknown(object):
217217
pass
218218
with pytest.raises(TypeError,
219-
message='SparseDataFrame called with unknown type '
220-
'"Unknown" for data argument'):
219+
match=('SparseDataFrame called with unknown type '
220+
'"Unknown" for data argument')):
221221
SparseDataFrame(Unknown())
222222

223223
def test_constructor_preserve_attr(self):

pandas/tests/test_config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ def test_deprecate_option(self):
249249
warnings.simplefilter('always')
250250
with pytest.raises(
251251
KeyError,
252-
message="Nonexistent option didn't raise KeyError"):
252+
match="No such keys.s.: 'foo'"):
253253
self.cf.get_option('foo')
254254
assert len(w) == 1 # should have raised one warning
255255
assert 'deprecated' in str(w[-1]) # we get the default message

0 commit comments

Comments
 (0)