diff options
author | Steve Purcell <steve@pythonconsulting.com> | 2003-10-26 10:41:03 (GMT) |
---|---|---|
committer | Steve Purcell <steve@pythonconsulting.com> | 2003-10-26 10:41:03 (GMT) |
commit | 397b45d4bacc057884c8ba18f83ef15d9bfb6149 (patch) | |
tree | 0fa61bb1d3b1a65003f0cd9e8786eea9ba3d2326 /Lib/unittest.py | |
parent | a253e183b807c8108f984758d2b1365bef977e6b (diff) | |
download | cpython-397b45d4bacc057884c8ba18f83ef15d9bfb6149.zip cpython-397b45d4bacc057884c8ba18f83ef15d9bfb6149.tar.gz cpython-397b45d4bacc057884c8ba18f83ef15d9bfb6149.tar.bz2 |
Incorporated patch 819077, from George Yoshida:
* Fixed typo in docstring for 'failUnlessAlmostEqual()'
* Removed unnecessary use of 'float()' for time values.
* Removed apparently unnecessary import of unittest. At some point in
the distant past I believe it was necessary otherwise the 'TestCase'
that a module saw was not the same as the 'TestCase' seen within
'unittest', and the user's TestCase subclasses were not recognised as
subclasses of the TestCase seen within unittest. Seems not to be
necessary now.
Diffstat (limited to 'Lib/unittest.py')
-rw-r--r-- | Lib/unittest.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/unittest.py b/Lib/unittest.py index d305d95..6567410 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.58 $"[11:-2] +__version__ = "#Revision: 1.61 $"[11:-2] import time import sys @@ -329,7 +329,7 @@ class TestCase: difference rounded to the given number of decimal places (default 7) and comparing to zero. - Note that decimal places (from zero) is usually not the same + Note that decimal places (from zero) are usually not the same as significant digits (measured from the most signficant digit). """ if round(second-first, places) != 0: @@ -509,19 +509,18 @@ class TestLoader: for part in parts: parent, obj = obj, getattr(obj, part) - import unittest if type(obj) == types.ModuleType: return self.loadTestsFromModule(obj) elif (isinstance(obj, (type, types.ClassType)) and - issubclass(obj, unittest.TestCase)): + issubclass(obj, TestCase)): return self.loadTestsFromTestCase(obj) elif type(obj) == types.UnboundMethodType: return parent(obj.__name__) - elif isinstance(obj, unittest.TestSuite): + elif isinstance(obj, TestSuite): return obj elif callable(obj): test = obj() - if not isinstance(test, (unittest.TestCase, unittest.TestSuite)): + if not isinstance(test, (TestCase, TestSuite)): raise ValueError, \ "calling %s returned %s, not a test" % (obj,test) return test @@ -674,7 +673,7 @@ class TextTestRunner: startTime = time.time() test(result) stopTime = time.time() - timeTaken = float(stopTime - startTime) + timeTaken = stopTime - startTime result.printErrors() self.stream.writeln(result.separator2) run = result.testsRun |