summaryrefslogtreecommitdiffstats
path: root/Lib/unittest
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-05-08 16:40:52 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-05-08 16:40:52 (GMT)
commit959c16d7a44e4cf6788ed751c58bbd5efc5a0107 (patch)
treea79afbe55a478a16d1d5f3c68c60ea3ee6c902a6 /Lib/unittest
parent7baf8627bd98c58988123688c07b470d89785b51 (diff)
downloadcpython-959c16d7a44e4cf6788ed751c58bbd5efc5a0107.zip
cpython-959c16d7a44e4cf6788ed751c58bbd5efc5a0107.tar.gz
cpython-959c16d7a44e4cf6788ed751c58bbd5efc5a0107.tar.bz2
Updating documentation and adding docstrings to unittest.TestCase.assertRegexpMatches and assertNotRegexpMatches. Issue 8038.
Diffstat (limited to 'Lib/unittest')
-rw-r--r--Lib/unittest/case.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index cbbe2b5..5c434d9 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -945,6 +945,7 @@ class TestCase(object):
callable_obj(*args, **kwargs)
def assertRegexpMatches(self, text, expected_regexp, msg=None):
+ """Fail the test unless the text matches the regular expression."""
if isinstance(expected_regexp, basestring):
expected_regexp = re.compile(expected_regexp)
if not expected_regexp.search(text):
@@ -953,6 +954,7 @@ class TestCase(object):
raise self.failureException(msg)
def assertNotRegexpMatches(self, text, unexpected_regexp, msg=None):
+ """Fail the test if the text matches the regular expression."""
if isinstance(unexpected_regexp, basestring):
unexpected_regexp = re.compile(unexpected_regexp)
match = unexpected_regexp.search(text)