summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/test/test_case.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/unittest/test/test_case.py')
-rw-r--r--Lib/unittest/test/test_case.py20
1 files changed, 8 insertions, 12 deletions
diff --git a/Lib/unittest/test/test_case.py b/Lib/unittest/test/test_case.py
index 6b34397..baabddd 100644
--- a/Lib/unittest/test/test_case.py
+++ b/Lib/unittest/test/test_case.py
@@ -1222,7 +1222,7 @@ test case
with self.assertRaises(self.failureException):
self.assertRaises(ExceptionMock, lambda: 0)
# Failure when the function is None
- with self.assertWarns(DeprecationWarning):
+ with self.assertRaises(TypeError):
self.assertRaises(ExceptionMock, None)
# Failure when another exception is raised
with self.assertRaises(ExceptionMock):
@@ -1253,8 +1253,7 @@ test case
with self.assertRaises(ExceptionMock, msg='foobar'):
pass
# Invalid keyword argument
- with self.assertWarnsRegex(DeprecationWarning, 'foobar'), \
- self.assertRaises(AssertionError):
+ with self.assertRaisesRegex(TypeError, 'foobar'):
with self.assertRaises(ExceptionMock, foobar=42):
pass
# Failure when another exception is raised
@@ -1295,7 +1294,7 @@ test case
self.assertRaisesRegex(ExceptionMock, re.compile('expect$'), Stub)
self.assertRaisesRegex(ExceptionMock, 'expect$', Stub)
- with self.assertWarns(DeprecationWarning):
+ with self.assertRaises(TypeError):
self.assertRaisesRegex(ExceptionMock, 'expect$', None)
def testAssertNotRaisesRegex(self):
@@ -1312,8 +1311,7 @@ test case
with self.assertRaisesRegex(Exception, 'expect', msg='foobar'):
pass
# Invalid keyword argument
- with self.assertWarnsRegex(DeprecationWarning, 'foobar'), \
- self.assertRaises(AssertionError):
+ with self.assertRaisesRegex(TypeError, 'foobar'):
with self.assertRaisesRegex(Exception, 'expect', foobar=42):
pass
@@ -1388,7 +1386,7 @@ test case
with self.assertRaises(self.failureException):
self.assertWarns(RuntimeWarning, lambda: 0)
# Failure when the function is None
- with self.assertWarns(DeprecationWarning):
+ with self.assertRaises(TypeError):
self.assertWarns(RuntimeWarning, None)
# Failure when another warning is triggered
with warnings.catch_warnings():
@@ -1433,8 +1431,7 @@ test case
with self.assertWarns(RuntimeWarning, msg='foobar'):
pass
# Invalid keyword argument
- with self.assertWarnsRegex(DeprecationWarning, 'foobar'), \
- self.assertRaises(AssertionError):
+ with self.assertRaisesRegex(TypeError, 'foobar'):
with self.assertWarns(RuntimeWarning, foobar=42):
pass
# Failure when another warning is triggered
@@ -1475,7 +1472,7 @@ test case
self.assertWarnsRegex(RuntimeWarning, "o+",
lambda: 0)
# Failure when the function is None
- with self.assertWarns(DeprecationWarning):
+ with self.assertRaises(TypeError):
self.assertWarnsRegex(RuntimeWarning, "o+", None)
# Failure when another warning is triggered
with warnings.catch_warnings():
@@ -1518,8 +1515,7 @@ test case
with self.assertWarnsRegex(RuntimeWarning, 'o+', msg='foobar'):
pass
# Invalid keyword argument
- with self.assertWarnsRegex(DeprecationWarning, 'foobar'), \
- self.assertRaises(AssertionError):
+ with self.assertRaisesRegex(TypeError, 'foobar'):
with self.assertWarnsRegex(RuntimeWarning, 'o+', foobar=42):
pass
# Failure when another warning is triggered