summaryrefslogtreecommitdiff
path: root/test/backunittest.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2012-11-04 12:33:20 -0500
committerNed Batchelder <ned@nedbatchelder.com>2012-11-04 12:33:20 -0500
commitdcf168545a75fde41888ad5a9e6d5a4b953bc2f3 (patch)
tree6e72517e07a2ec7dad01a14e647632f1220939af /test/backunittest.py
parent42805dfb8344989d927699d42abd5e599347ba18 (diff)
downloadpython-coveragepy-git-dcf168545a75fde41888ad5a9e6d5a4b953bc2f3.tar.gz
Make my backport of assertRegexpMatches truly compatible with the stdlib definition
Diffstat (limited to 'test/backunittest.py')
-rw-r--r--test/backunittest.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/backunittest.py b/test/backunittest.py
index c1685e0c..7ec34f5c 100644
--- a/test/backunittest.py
+++ b/test/backunittest.py
@@ -66,11 +66,12 @@ class TestCase(unittest.TestCase):
self.assertEqual(set(s1), set(s2))
if _need('assertRegexpMatches'):
- def assertRegexpMatches(self, s, regex):
- """Assert that `s` matches `regex`."""
- m = re.search(regex, s)
+ def assertRegexpMatches(self, text, regex, msg=None):
+ """Assert that `text` matches `regex`."""
+ m = re.search(regex, text)
if not m:
- raise self.failureException("%r doesn't match %r" % (s, regex))
+ msg = msg or ("%r doesn't match %r" % (text, regex))
+ raise self.failureException(msg)
if _need('assertMultiLineEqual'):
def assertMultiLineEqual(self, first, second, msg=None):