@@ -1222,7 +1222,7 @@ def Stub():
12221222 with self .assertRaises (self .failureException ):
12231223 self .assertRaises (ExceptionMock , lambda : 0 )
12241224 # Failure when the function is None
1225- with self .assertWarns ( DeprecationWarning ):
1225+ with self .assertRaises ( TypeError ):
12261226 self .assertRaises (ExceptionMock , None )
12271227 # Failure when another exception is raised
12281228 with self .assertRaises (ExceptionMock ):
@@ -1253,8 +1253,7 @@ def Stub():
12531253 with self .assertRaises (ExceptionMock , msg = 'foobar' ):
12541254 pass
12551255 # Invalid keyword argument
1256- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1257- self .assertRaises (AssertionError ):
1256+ with self .assertRaisesRegex (TypeError , 'foobar' ):
12581257 with self .assertRaises (ExceptionMock , foobar = 42 ):
12591258 pass
12601259 # Failure when another exception is raised
@@ -1295,7 +1294,7 @@ def Stub():
12951294
12961295 self .assertRaisesRegex (ExceptionMock , re .compile ('expect$' ), Stub )
12971296 self .assertRaisesRegex (ExceptionMock , 'expect$' , Stub )
1298- with self .assertWarns ( DeprecationWarning ):
1297+ with self .assertRaises ( TypeError ):
12991298 self .assertRaisesRegex (ExceptionMock , 'expect$' , None )
13001299
13011300 def testAssertNotRaisesRegex (self ):
@@ -1312,8 +1311,7 @@ def testAssertNotRaisesRegex(self):
13121311 with self .assertRaisesRegex (Exception , 'expect' , msg = 'foobar' ):
13131312 pass
13141313 # Invalid keyword argument
1315- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1316- self .assertRaises (AssertionError ):
1314+ with self .assertRaisesRegex (TypeError , 'foobar' ):
13171315 with self .assertRaisesRegex (Exception , 'expect' , foobar = 42 ):
13181316 pass
13191317
@@ -1388,7 +1386,7 @@ def _runtime_warn():
13881386 with self .assertRaises (self .failureException ):
13891387 self .assertWarns (RuntimeWarning , lambda : 0 )
13901388 # Failure when the function is None
1391- with self .assertWarns ( DeprecationWarning ):
1389+ with self .assertRaises ( TypeError ):
13921390 self .assertWarns (RuntimeWarning , None )
13931391 # Failure when another warning is triggered
13941392 with warnings .catch_warnings ():
@@ -1433,8 +1431,7 @@ def _runtime_warn():
14331431 with self .assertWarns (RuntimeWarning , msg = 'foobar' ):
14341432 pass
14351433 # Invalid keyword argument
1436- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1437- self .assertRaises (AssertionError ):
1434+ with self .assertRaisesRegex (TypeError , 'foobar' ):
14381435 with self .assertWarns (RuntimeWarning , foobar = 42 ):
14391436 pass
14401437 # Failure when another warning is triggered
@@ -1475,7 +1472,7 @@ def _runtime_warn(msg):
14751472 self .assertWarnsRegex (RuntimeWarning , "o+" ,
14761473 lambda : 0 )
14771474 # Failure when the function is None
1478- with self .assertWarns ( DeprecationWarning ):
1475+ with self .assertRaises ( TypeError ):
14791476 self .assertWarnsRegex (RuntimeWarning , "o+" , None )
14801477 # Failure when another warning is triggered
14811478 with warnings .catch_warnings ():
@@ -1518,8 +1515,7 @@ def _runtime_warn(msg):
15181515 with self .assertWarnsRegex (RuntimeWarning , 'o+' , msg = 'foobar' ):
15191516 pass
15201517 # Invalid keyword argument
1521- with self .assertWarnsRegex (DeprecationWarning , 'foobar' ), \
1522- self .assertRaises (AssertionError ):
1518+ with self .assertRaisesRegex (TypeError , 'foobar' ):
15231519 with self .assertWarnsRegex (RuntimeWarning , 'o+' , foobar = 42 ):
15241520 pass
15251521 # Failure when another warning is triggered
0 commit comments