]> granicus.if.org Git - python/commitdiff
Updating documentation and adding docstrings to unittest.TestCase.assertRegexpMatches...
authorMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 8 May 2010 16:40:52 +0000 (16:40 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 8 May 2010 16:40:52 +0000 (16:40 +0000)
Doc/library/unittest.rst
Lib/unittest/case.py

index f3bd78057d3fd0ee401f85be2e7931398d30c722..06fd78176e0bfbee592813ece20320f8142c3901 100644 (file)
@@ -907,9 +907,9 @@ Test cases
    .. method:: assertNotRegexpMatches(text, regexp, msg=None)
 
       Verifies that a *regexp* search does not match *text*.  Fails with an error
-      message including the pattern and the *text*.  *regexp* may be
-      a regular expression object or a string containing a regular expression
-      suitable for use by :func:`re.search`.
+      message including the pattern and the part of *text* that matches.  *regexp*
+      may be a regular expression object or a string containing a regular
+      expression suitable for use by :func:`re.search`.
 
       .. versionadded:: 2.7
 
index cbbe2b5962e4c9cac4853965a97dbc436fba5d70..5c434d9e31f6268df74d39838761a9ed39850eb8 100644 (file)
@@ -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)