[Python-checkins] python/dist/src/Lib unittest.py,1.30,1.31

purcell at users.sourceforge.net purcell at users.sourceforge.net
Sun Oct 26 05:41:06 EST 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv30693

Modified Files:
	unittest.py 
Log Message:
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.


Index: unittest.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/unittest.py,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** unittest.py	24 Oct 2003 17:15:29 -0000	1.30
--- unittest.py	26 Oct 2003 10:41:03 -0000	1.31
***************
*** 47,51 ****
  __author__ = "Steve Purcell"
  __email__ = "stephen_purcell at yahoo dot com"
! __version__ = "#Revision: 1.58 $"[11:-2]
  
  import time
--- 47,51 ----
  __author__ = "Steve Purcell"
  __email__ = "stephen_purcell at yahoo dot com"
! __version__ = "#Revision: 1.61 $"[11:-2]
  
  import time
***************
*** 330,334 ****
             (default 7) and comparing to zero.
  
!            Note that decimal places (from zero) is usually not the same
             as significant digits (measured from the most signficant digit).
          """
--- 330,334 ----
             (default 7) and comparing to zero.
  
!            Note that decimal places (from zero) are usually not the same
             as significant digits (measured from the most signficant digit).
          """
***************
*** 510,526 ****
              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)):
              return self.loadTestsFromTestCase(obj)
          elif type(obj) == types.UnboundMethodType:
              return parent(obj.__name__)
!         elif isinstance(obj, unittest.TestSuite):
              return obj
          elif callable(obj):
              test = obj()
!             if not isinstance(test, (unittest.TestCase, unittest.TestSuite)):
                  raise ValueError, \
                        "calling %s returned %s, not a test" % (obj,test)
--- 510,525 ----
              parent, obj = obj, getattr(obj, part)
  
          if type(obj) == types.ModuleType:
              return self.loadTestsFromModule(obj)
          elif (isinstance(obj, (type, types.ClassType)) and
!               issubclass(obj, TestCase)):
              return self.loadTestsFromTestCase(obj)
          elif type(obj) == types.UnboundMethodType:
              return parent(obj.__name__)
!         elif isinstance(obj, TestSuite):
              return obj
          elif callable(obj):
              test = obj()
!             if not isinstance(test, (TestCase, TestSuite)):
                  raise ValueError, \
                        "calling %s returned %s, not a test" % (obj,test)
***************
*** 675,679 ****
          test(result)
          stopTime = time.time()
!         timeTaken = float(stopTime - startTime)
          result.printErrors()
          self.stream.writeln(result.separator2)
--- 674,678 ----
          test(result)
          stopTime = time.time()
!         timeTaken = stopTime - startTime
          result.printErrors()
          self.stream.writeln(result.separator2)





More information about the Python-checkins mailing list