[Python-checkins] python/nondist/sandbox/twister test_random.py,1.9,1.10

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Sun, 29 Dec 2002 10:02:04 -0800


Update of /cvsroot/python/python/nondist/sandbox/twister
In directory sc8-pr-cvs1:/tmp/cvs-serv19212

Modified Files:
	test_random.py 
Log Message:
Use unittest's new assertAlmostEqual method.


Index: test_random.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/twister/test_random.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** test_random.py	29 Dec 2002 10:50:23 -0000	1.9
--- test_random.py	29 Dec 2002 18:02:01 -0000	1.10
***************
*** 116,120 ****
          actual = self.randomlist(2000)[-10:]
          for a, e in zip(actual, expected):
!             self.assertEqual(round(a-e, 14), 0)
  
      def test_strong_reference_implementation(self):
--- 116,120 ----
          actual = self.randomlist(2000)[-10:]
          for a, e in zip(actual, expected):
!             self.assertAlmostEqual(a,e,places=14)
  
      def test_strong_reference_implementation(self):
***************
*** 151,158 ****
  
  class TestModule(unittest.TestCase):
-     def assertAlmostEqual(self, computed, expected):
-         """Helper function to test constants being within a given tolerance"""
-         self.failIf(abs(computed - expected) > 1e-7)
- 
      def testMagicConstants(self):
          self.assertAlmostEqual(random.NV_MAGICCONST, 1.71552776992141)
--- 151,154 ----