[Python-checkins] python/nondist/sandbox/decimal test_Decimal.py, 1.25, 1.26

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Thu Jul 1 05:27:33 EDT 2004


Update of /cvsroot/python/python/nondist/sandbox/decimal
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13344

Modified Files:
	test_Decimal.py 
Log Message:
Adjust test logic to handle -u resource option from regrtest.py to control
whether the full set of arithmetic tests are run.



Index: test_Decimal.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/decimal/test_Decimal.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** test_Decimal.py	1 Jul 2004 06:44:52 -0000	1.25
--- test_Decimal.py	1 Jul 2004 09:27:30 -0000	1.26
***************
*** 32,36 ****
  import pickle, copy
  from Decimal import *
! from test.test_support import TestSkipped, run_unittest, run_doctest
  
  
--- 32,36 ----
  import pickle, copy
  from Decimal import *
! from test.test_support import TestSkipped, run_unittest, run_doctest, is_resource_enabled
  
  
***************
*** 1047,1072 ****
          self.assertEqual(d, e)
  
! def test_main(which=None, verbose=None):
      """ Execute the tests.
  
!     If called with "Arithmetic", just executes the arithmetic tests.
!     If called with "Behaviour", just executes the pythonic behaviour tests.
!     Otherwise, executes both of them.
      """
!     test_classes = []
  
!     if which is None or which.lower().startswith("arith"):
          test_classes.extend([DecimalTest])
  
-     if which is None or which.lower().startswith("behav"):
-         test_classes.extend([
-             DecimalExplicitConstructionTest,
-             DecimalImplicitConstructionTest,
-             DecimalArithmeticOperatorsTest,
-             DecimalUseOfContextTest,
-             DecimalUsabilityTest,
-             DecimalPythonAPItests,
-         ])
- 
      run_unittest(*test_classes)
      import Decimal as DecimalModule
--- 1047,1068 ----
          self.assertEqual(d, e)
  
! def test_main(arith=False, verbose=None):
      """ Execute the tests.
  
!     Runs arithmetic tests if arith is True or if the "decimal" resource
!     is enables in regrtest.py
      """
!     test_classes = [
!         DecimalExplicitConstructionTest,
!         DecimalImplicitConstructionTest,
!         DecimalArithmeticOperatorsTest,
!         DecimalUseOfContextTest,
!         DecimalUsabilityTest,
!         DecimalPythonAPItests,
!     ]
  
!     if arith or is_resource_enabled('decimal'):
          test_classes.extend([DecimalTest])
  
      run_unittest(*test_classes)
      import Decimal as DecimalModule
***************
*** 1076,1083 ****
  
  if __name__ == '__main__':
      if len(sys.argv) == 1:
!         test_main(verbose=True)
      elif len(sys.argv) == 2:
!         test_main(sys.argv[1], verbose=True)
      else:
!         raise ValueError, "test called with wrong arguments, use test_Decimal [Arithmetic|Behaviour]"
--- 1072,1082 ----
  
  if __name__ == '__main__':
+     # Calling with no arguments runs all tests.
+     # Calling with "Skip" will skipover the arithmetic tests.
      if len(sys.argv) == 1:
!         test_main(arith=True, verbose=True)
      elif len(sys.argv) == 2:
!         arith = sys.argv[1].lower() != 'skip'
!         test_main(arith=arith, verbose=True)
      else:
!         raise ValueError("test called with wrong arguments, use test_Decimal [Skip]")




More information about the Python-checkins mailing list