diff options
-rw-r--r-- | Lib/unittest.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/unittest.py b/Lib/unittest.py index ae751af..2714a58 100644 --- a/Lib/unittest.py +++ b/Lib/unittest.py @@ -46,7 +46,7 @@ SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. __author__ = "Steve Purcell" __email__ = "stephen_purcell at yahoo dot com" -__version__ = "#Revision: 1.45 $"[11:-2] +__version__ = "#Revision: 1.46 $"[11:-2] import time import sys @@ -62,6 +62,9 @@ import types # All classes defined herein are 'new-style' classes, allowing use of 'super()' __metaclass__ = type +def _strclass(cls): + return "%s.%s" % (cls.__module__, cls.__name__) + class TestResult: """Holder for test result information. @@ -116,7 +119,7 @@ class TestResult: def __repr__(self): return "<%s run=%i errors=%i failures=%i>" % \ - (self.__class__, self.testsRun, len(self.errors), + (_strclass(self.__class__), self.testsRun, len(self.errors), len(self.failures)) @@ -186,14 +189,14 @@ class TestCase: return doc and string.strip(string.split(doc, "\n")[0]) or None def id(self): - return "%s.%s" % (self.__class__, self.__testMethodName) + return "%s.%s" % (_strclass(self.__class__), self.__testMethodName) def __str__(self): return "%s (%s)" % (self.__testMethodName, self.__class__) def __repr__(self): return "<%s testMethod=%s>" % \ - (self.__class__, self.__testMethodName) + (_strclass(self.__class__), self.__testMethodName) def run(self, result=None): return self(result) @@ -321,7 +324,7 @@ class TestSuite: self.addTests(tests) def __repr__(self): - return "<%s tests=%s>" % (self.__class__, self._tests) + return "<%s tests=%s>" % (_strclass(self.__class__), self._tests) __str__ = __repr__ @@ -385,10 +388,10 @@ class FunctionTestCase(TestCase): return self.__testFunc.__name__ def __str__(self): - return "%s (%s)" % (self.__class__, self.__testFunc.__name__) + return "%s (%s)" % (_strclass(self.__class__), self.__testFunc.__name__) def __repr__(self): - return "<%s testFunc=%s>" % (self.__class__, self.__testFunc) + return "<%s testFunc=%s>" % (_strclass(self.__class__), self.__testFunc) def shortDescription(self): if self.__description is not None: return self.__description |