diff options
author | Georg Brandl <georg@python.org> | 2010-02-07 11:34:15 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2010-02-07 11:34:15 (GMT) |
commit | b0eb4d3eb1e51bc54f5d33eacee2653ce5322f1a (patch) | |
tree | d6ea77621d584a21dab08dd944ce9eeb02a7e5f8 /Lib/unittest/case.py | |
parent | 9341ad22002ca300d3d2e3d71b60f13e5638a5a4 (diff) | |
download | cpython-b0eb4d3eb1e51bc54f5d33eacee2653ce5322f1a.zip cpython-b0eb4d3eb1e51bc54f5d33eacee2653ce5322f1a.tar.gz cpython-b0eb4d3eb1e51bc54f5d33eacee2653ce5322f1a.tar.bz2 |
Use "regexp" consistently.
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r-- | Lib/unittest/case.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py index 4568e10..854ebc4 100644 --- a/Lib/unittest/case.py +++ b/Lib/unittest/case.py @@ -88,7 +88,7 @@ class _AssertRaisesContext(object): def __init__(self, expected, test_case, expected_regexp=None): self.expected = expected self.failureException = test_case.failureException - self.expected_regex = expected_regexp + self.expected_regexp = expected_regexp def __enter__(self): pass @@ -105,10 +105,10 @@ class _AssertRaisesContext(object): # let unexpected exceptions pass through return False self.exc_value = exc_value #store for later retrieval - if self.expected_regex is None: + if self.expected_regexp is None: return True - expected_regexp = self.expected_regex + expected_regexp = self.expected_regexp if isinstance(expected_regexp, basestring): expected_regexp = re.compile(expected_regexp) if not expected_regexp.search(str(exc_value)): @@ -853,12 +853,12 @@ class TestCase(object): with context: callable_obj(*args, **kwargs) - def assertRegexpMatches(self, text, expected_regex, msg=None): - if isinstance(expected_regex, basestring): - expected_regex = re.compile(expected_regex) - if not expected_regex.search(text): + def assertRegexpMatches(self, text, expected_regexp, msg=None): + if isinstance(expected_regexp, basestring): + expected_regexp = re.compile(expected_regexp) + if not expected_regexp.search(text): msg = msg or "Regexp didn't match" - msg = '%s: %r not found in %r' % (msg, expected_regex.pattern, text) + msg = '%s: %r not found in %r' % (msg, expected_regexp.pattern, text) raise self.failureException(msg) |