mirror of
https://github.com/python/cpython.git
synced 2025-07-30 06:34:15 +00:00
Issue 7893 and Issue 7588
This commit is contained in:
parent
42fb6ab491
commit
db43b5a1f5
7 changed files with 101 additions and 46 deletions
|
@ -216,18 +216,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)
|
||||
|
@ -488,7 +485,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
|
||||
|
@ -505,6 +501,7 @@ class TestCase(object):
|
|||
failUnlessAlmostEqual = _deprecate(assertAlmostEqual)
|
||||
failIfAlmostEqual = _deprecate(assertNotAlmostEqual)
|
||||
failUnless = _deprecate(assertTrue)
|
||||
assert_ = _deprecate(assertTrue)
|
||||
failUnlessRaises = _deprecate(assertRaises)
|
||||
failIf = _deprecate(assertFalse)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue