Commit 8f776307 authored by Ezio Melotti's avatar Ezio Melotti

#10273: Remove a "Matches" that I missed in r86910. Thanks to RDM for noticing it.

parent 522cc0a9
...@@ -1127,7 +1127,7 @@ class TestCase(object): ...@@ -1127,7 +1127,7 @@ class TestCase(object):
msg = '%s: %r not found in %r' % (msg, expected_regex.pattern, text) msg = '%s: %r not found in %r' % (msg, expected_regex.pattern, text)
raise self.failureException(msg) raise self.failureException(msg)
def assertNotRegexMatches(self, text, unexpected_regex, msg=None): def assertNotRegex(self, text, unexpected_regex, msg=None):
"""Fail the test if the text matches the regular expression.""" """Fail the test if the text matches the regular expression."""
if isinstance(unexpected_regex, (str, bytes)): if isinstance(unexpected_regex, (str, bytes)):
unexpected_regex = re.compile(unexpected_regex) unexpected_regex = re.compile(unexpected_regex)
......
...@@ -92,15 +92,15 @@ class Test_Assertions(unittest.TestCase): ...@@ -92,15 +92,15 @@ class Test_Assertions(unittest.TestCase):
else: else:
self.fail("assertRaises() didn't let exception pass through") self.fail("assertRaises() didn't let exception pass through")
def testAssertNotRegexMatches(self): def testAssertNotRegex(self):
self.assertNotRegexMatches('Ala ma kota', r'r+') self.assertNotRegex('Ala ma kota', r'r+')
try: try:
self.assertNotRegexMatches('Ala ma kota', r'k.t', 'Message') self.assertNotRegex('Ala ma kota', r'k.t', 'Message')
except self.failureException as e: except self.failureException as e:
self.assertIn("'kot'", e.args[0]) self.assertIn("'kot'", e.args[0])
self.assertIn('Message', e.args[0]) self.assertIn('Message', e.args[0])
else: else:
self.fail('assertNotRegexMatches should have failed.') self.fail('assertNotRegex should have failed.')
class TestLongMessage(unittest.TestCase): class TestLongMessage(unittest.TestCase):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment