@@ -1222,7 +1222,7 @@ def Stub():
1222
1222
with self .assertRaises (self .failureException ):
1223
1223
self .assertRaises (ExceptionMock , lambda : 0 )
1224
1224
# Failure when the function is None
1225
- with self .assertWarns ( DeprecationWarning ):
1225
+ with self .assertRaises ( TypeError ):
1226
1226
self .assertRaises (ExceptionMock , None )
1227
1227
# Failure when another exception is raised
1228
1228
with self .assertRaises (ExceptionMock ):
@@ -1253,8 +1253,7 @@ def Stub():
1253
1253
with self .assertRaises (ExceptionMock , msg = 'foobar' ):
1254
1254
pass
1255
1255
# Invalid keyword argument
1256
- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1257
- self .assertRaises (AssertionError ):
1256
+ with self .assertRaisesRegex (TypeError , 'foobar' ):
1258
1257
with self .assertRaises (ExceptionMock , foobar = 42 ):
1259
1258
pass
1260
1259
# Failure when another exception is raised
@@ -1295,7 +1294,7 @@ def Stub():
1295
1294
1296
1295
self .assertRaisesRegex (ExceptionMock , re .compile ('expect$' ), Stub )
1297
1296
self .assertRaisesRegex (ExceptionMock , 'expect$' , Stub )
1298
- with self .assertWarns ( DeprecationWarning ):
1297
+ with self .assertRaises ( TypeError ):
1299
1298
self .assertRaisesRegex (ExceptionMock , 'expect$' , None )
1300
1299
1301
1300
def testAssertNotRaisesRegex (self ):
@@ -1312,8 +1311,7 @@ def testAssertNotRaisesRegex(self):
1312
1311
with self .assertRaisesRegex (Exception , 'expect' , msg = 'foobar' ):
1313
1312
pass
1314
1313
# Invalid keyword argument
1315
- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1316
- self .assertRaises (AssertionError ):
1314
+ with self .assertRaisesRegex (TypeError , 'foobar' ):
1317
1315
with self .assertRaisesRegex (Exception , 'expect' , foobar = 42 ):
1318
1316
pass
1319
1317
@@ -1388,7 +1386,7 @@ def _runtime_warn():
1388
1386
with self .assertRaises (self .failureException ):
1389
1387
self .assertWarns (RuntimeWarning , lambda : 0 )
1390
1388
# Failure when the function is None
1391
- with self .assertWarns ( DeprecationWarning ):
1389
+ with self .assertRaises ( TypeError ):
1392
1390
self .assertWarns (RuntimeWarning , None )
1393
1391
# Failure when another warning is triggered
1394
1392
with warnings .catch_warnings ():
@@ -1433,8 +1431,7 @@ def _runtime_warn():
1433
1431
with self .assertWarns (RuntimeWarning , msg = 'foobar' ):
1434
1432
pass
1435
1433
# Invalid keyword argument
1436
- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1437
- self .assertRaises (AssertionError ):
1434
+ with self .assertRaisesRegex (TypeError , 'foobar' ):
1438
1435
with self .assertWarns (RuntimeWarning , foobar = 42 ):
1439
1436
pass
1440
1437
# Failure when another warning is triggered
@@ -1475,7 +1472,7 @@ def _runtime_warn(msg):
1475
1472
self .assertWarnsRegex (RuntimeWarning , "o+" ,
1476
1473
lambda : 0 )
1477
1474
# Failure when the function is None
1478
- with self .assertWarns ( DeprecationWarning ):
1475
+ with self .assertRaises ( TypeError ):
1479
1476
self .assertWarnsRegex (RuntimeWarning , "o+" , None )
1480
1477
# Failure when another warning is triggered
1481
1478
with warnings .catch_warnings ():
@@ -1518,8 +1515,7 @@ def _runtime_warn(msg):
1518
1515
with self .assertWarnsRegex (RuntimeWarning , 'o+' , msg = 'foobar' ):
1519
1516
pass
1520
1517
# Invalid keyword argument
1521
- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1522
- self .assertRaises (AssertionError ):
1518
+ with self .assertRaisesRegex (TypeError , 'foobar' ):
1523
1519
with self .assertWarnsRegex (RuntimeWarning , 'o+' , foobar = 42 ):
1524
1520
pass
1525
1521
# Failure when another warning is triggered
0 commit comments