]> granicus.if.org Git - python/commitdiff
Merged revisions 80990 via svnmerge from
authorMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 8 May 2010 16:46:14 +0000 (16:46 +0000)
committerMichael Foord <fuzzyman@voidspace.org.uk>
Sat, 8 May 2010 16:46:14 +0000 (16:46 +0000)
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r80990 | michael.foord | 2010-05-08 18:40:52 +0200 (Sat, 08 May 2010) | 1 line

  Updating documentation and adding docstrings to unittest.TestCase.assertRegexpMatches and assertNotRegexpMatches. Issue 8038.
........

Doc/library/unittest.rst
Lib/unittest/case.py

index b5b23c784f96600aa4b04baaab37aedc607ea5ab..19c8b0b157d39eaa19840a22351702434df5c891 100644 (file)
@@ -903,9 +903,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:: 3.2
 
index 366fe8703c32679e5f646dbd6277d715a46e5437..cbe8dcbca34079c295f43cb38a648b6d053a3ed2 100644 (file)
@@ -993,6 +993,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, (str, bytes)):
             expected_regexp = re.compile(expected_regexp)
         if not expected_regexp.search(text):
@@ -1001,6 +1002,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, (str, bytes)):
             unexpected_regexp = re.compile(unexpected_regexp)
         match = unexpected_regexp.search(text)