summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_exceptions.py2
-rw-r--r--Lib/test/test_unittest/test_case.py10
2 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py
index 3138f50..7e8e058 100644
--- a/Lib/test/test_exceptions.py
+++ b/Lib/test/test_exceptions.py
@@ -1836,6 +1836,8 @@ class NameErrorTests(unittest.TestCase):
except self.failureException:
with support.captured_stderr() as err:
sys.__excepthook__(*sys.exc_info())
+ else:
+ self.fail("assertRaisesRegex should have failed.")
self.assertIn("aab", err.getvalue())
diff --git a/Lib/test/test_unittest/test_case.py b/Lib/test/test_unittest/test_case.py
index ed5eb56..82a442a 100644
--- a/Lib/test/test_unittest/test_case.py
+++ b/Lib/test/test_unittest/test_case.py
@@ -1132,6 +1132,8 @@ test case
# need to remove the first line of the error message
error = str(e).split('\n', 1)[1]
self.assertEqual(sample_text_error, error)
+ else:
+ self.fail(f'{self.failureException} not raised')
def testAssertEqualSingleLine(self):
sample_text = "laden swallows fly slowly"
@@ -1148,6 +1150,8 @@ test case
# need to remove the first line of the error message
error = str(e).split('\n', 1)[1]
self.assertEqual(sample_text_error, error)
+ else:
+ self.fail(f'{self.failureException} not raised')
def testAssertEqualwithEmptyString(self):
'''Verify when there is an empty string involved, the diff output
@@ -1165,6 +1169,8 @@ test case
# need to remove the first line of the error message
error = str(e).split('\n', 1)[1]
self.assertEqual(sample_text_error, error)
+ else:
+ self.fail(f'{self.failureException} not raised')
def testAssertEqualMultipleLinesMissingNewlineTerminator(self):
'''Verifying format of diff output from assertEqual involving strings
@@ -1185,6 +1191,8 @@ test case
# need to remove the first line of the error message
error = str(e).split('\n', 1)[1]
self.assertEqual(sample_text_error, error)
+ else:
+ self.fail(f'{self.failureException} not raised')
def testAssertEqualMultipleLinesMismatchedNewlinesTerminators(self):
'''Verifying format of diff output from assertEqual involving strings
@@ -1208,6 +1216,8 @@ test case
# need to remove the first line of the error message
error = str(e).split('\n', 1)[1]
self.assertEqual(sample_text_error, error)
+ else:
+ self.fail(f'{self.failureException} not raised')
def testEqualityBytesWarning(self):
if sys.flags.bytes_warning: