[Python-checkins] python/dist/src/Lib/test test_builtin.py,1.5,1.6 test_long.py,1.21,1.22

nnorwitz@users.sourceforge.net nnorwitz@users.sourceforge.net
Tue, 28 Jan 2003 11:22:00 -0800


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

Modified Files:
	test_builtin.py test_long.py 
Log Message:
Fix SF bug# 676155, RuntimeWarning with tp_compare

Check return value of PyLong_AsDouble(), it can return an error.


Index: test_builtin.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_builtin.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** test_builtin.py	27 Jan 2003 15:57:14 -0000	1.5
--- test_builtin.py	28 Jan 2003 19:21:18 -0000	1.6
***************
*** 187,190 ****
--- 187,191 ----
                  raise ValueError
          self.assertRaises(ValueError, coerce, 42, BadNumber())
+         self.assertRaises(OverflowError, coerce, 0.5, int("12345" * 1000))
  
      def test_compile(self):

Index: test_long.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_long.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** test_long.py	19 Nov 2002 20:49:13 -0000	1.21
--- test_long.py	28 Jan 2003 19:21:19 -0000	1.22
***************
*** 372,378 ****
          verify(float(long(x)) == x)
  
      huge = 1L << 30000
      mhuge = -huge
!     namespace = {'huge': huge, 'mhuge': mhuge, 'math': math}
      for test in ["float(huge)", "float(mhuge)",
                   "complex(huge)", "complex(mhuge)",
--- 372,379 ----
          verify(float(long(x)) == x)
  
+     shuge = '12345' * 1000
      huge = 1L << 30000
      mhuge = -huge
!     namespace = {'huge': huge, 'mhuge': mhuge, 'shuge': shuge, 'math': math}
      for test in ["float(huge)", "float(mhuge)",
                   "complex(huge)", "complex(mhuge)",
***************
*** 387,391 ****
                   "math.sin(huge)", "math.sin(mhuge)",
                   "math.sqrt(huge)", "math.sqrt(mhuge)", # should do better
!                  "math.floor(huge)", "math.floor(mhuge)"]:
  
          try:
--- 388,393 ----
                   "math.sin(huge)", "math.sin(mhuge)",
                   "math.sqrt(huge)", "math.sqrt(mhuge)", # should do better
!                  "math.floor(huge)", "math.floor(mhuge)",
!                  "float(shuge) == int(shuge)"]:
  
          try: