summaryrefslogtreecommitdiffstats
path: root/Lib/unittest/case.py
diff options
context:
space:
mode:
authorMichael Foord <fuzzyman@voidspace.org.uk>2010-02-10 15:51:42 (GMT)
committerMichael Foord <fuzzyman@voidspace.org.uk>2010-02-10 15:51:42 (GMT)
commit34c9462d713275762803f102a68f23dd2bb7460a (patch)
treeb56e5520cce62534e26f55285f1ded54de3caa06 /Lib/unittest/case.py
parent99f69ee7a1cf4d032d420ad69d22bd44b8cf6cc8 (diff)
downloadcpython-34c9462d713275762803f102a68f23dd2bb7460a.zip
cpython-34c9462d713275762803f102a68f23dd2bb7460a.tar.gz
cpython-34c9462d713275762803f102a68f23dd2bb7460a.tar.bz2
Merged revisions 78130 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78130 | michael.foord | 2010-02-10 14:25:12 +0000 (Wed, 10 Feb 2010) | 1 line Issue 7893 and Issue 7588 ........
Diffstat (limited to 'Lib/unittest/case.py')
-rw-r--r--Lib/unittest/case.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/Lib/unittest/case.py b/Lib/unittest/case.py
index cf180d7..cd0764d 100644
--- a/Lib/unittest/case.py
+++ b/Lib/unittest/case.py
@@ -229,18 +229,15 @@ class TestCase(object):
return result.TestResult()
def shortDescription(self):
- """Returns both the test method name and first line of its docstring.
+ """Returns a one-line description of the test, or None if no
+ description has been provided.
- If no docstring is given, only returns the method name.
+ The default implementation of this method returns the first line of
+ the specified test method's docstring.
"""
- desc = str(self)
- doc_first_line = None
+ doc = self._testMethodDoc
+ return doc and doc.split("\n")[0].strip() or None
- if self._testMethodDoc:
- doc_first_line = self._testMethodDoc.split("\n")[0].strip()
- if doc_first_line:
- desc = '\n'.join((desc, doc_first_line))
- return desc
def id(self):
return "%s.%s" % (util.strclass(self.__class__), self._testMethodName)
@@ -501,7 +498,6 @@ class TestCase(object):
assertNotEquals = assertNotEqual
assertAlmostEquals = assertAlmostEqual
assertNotAlmostEquals = assertNotAlmostEqual
- assert_ = assertTrue
# These fail* assertion method names are pending deprecation and will
# be a DeprecationWarning in 3.2; http://bugs.python.org/issue2578
@@ -518,6 +514,7 @@ class TestCase(object):
failUnlessAlmostEqual = _deprecate(assertAlmostEqual)
failIfAlmostEqual = _deprecate(assertNotAlmostEqual)
failUnless = _deprecate(assertTrue)
+ assert_ = _deprecate(assertTrue)
failUnlessRaises = _deprecate(assertRaises)
failIf = _deprecate(assertFalse)