#10273: Rename assertRegexpMatches and assertRaisesRegexp to assertRegex and assertRaisesRegex.

This commit is contained in:
Ezio Melotti 2010-12-01 02:32:32 +00:00
parent f10c400b91
commit ed3a7d2d60
21 changed files with 203 additions and 186 deletions

View file

@ -92,15 +92,15 @@ 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+')
def testAssertNotRegexMatches(self):
self.assertNotRegexMatches('Ala ma kota', r'r+')
try:
self.assertNotRegexpMatches('Ala ma kota', r'k.t', 'Message')
self.assertNotRegexMatches('Ala ma kota', r'k.t', 'Message')
except self.failureException as e:
self.assertIn("'kot'", e.args[0])
self.assertIn('Message', e.args[0])
else:
self.fail('assertNotRegexpMatches should have failed.')
self.fail('assertNotRegexMatches should have failed.')
class TestLongMessage(unittest.TestCase):
@ -153,15 +153,15 @@ class TestLongMessage(unittest.TestCase):
test = self.testableTrue
return getattr(test, methodName)
for i, expected_regexp in enumerate(errors):
for i, expected_regex in enumerate(errors):
testMethod = getMethod(i)
kwargs = {}
withMsg = i % 2
if withMsg:
kwargs = {"msg": "oops"}
with self.assertRaisesRegexp(self.failureException,
expected_regexp=expected_regexp):
with self.assertRaisesRegex(self.failureException,
expected_regex=expected_regex):
testMethod(*args, **kwargs)
def testAssertTrue(self):