mirror of
https://github.com/python/cpython.git
synced 2025-08-10 03:49:18 +00:00
Issue #8038: Addition of unittest.TestCase.assertNotRegexpMatches
This commit is contained in:
parent
25d7976014
commit
a04c7a0f16
3 changed files with 27 additions and 0 deletions
|
@ -91,6 +91,16 @@ class Test_Assertions(unittest.TestCase):
|
|||
else:
|
||||
self.fail("assertRaises() didn't let exception pass through")
|
||||
|
||||
def testAssertNotRegexpMatches(self):
|
||||
self.assertNotRegexpMatches('Ala ma kota', r'r+')
|
||||
try:
|
||||
self.assertNotRegexpMatches('Ala ma kota', r'k.t', 'Message')
|
||||
except self.failureException, e:
|
||||
self.assertIn("'kot'", e.args[0])
|
||||
self.assertIn('Message', e.args[0])
|
||||
else:
|
||||
self.fail('assertNotRegexpMatches should have failed.')
|
||||
|
||||
|
||||
class TestLongMessage(unittest.TestCase):
|
||||
"""Test that the individual asserts honour longMessage.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue