Issue #8038: Addition of unittest.TestCase.assertNotRegexpMatches

This commit is contained in:
Michael Foord 2010-04-02 22:55:59 +00:00
parent 25d7976014
commit a04c7a0f16
3 changed files with 27 additions and 0 deletions

View file

@ -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.