[Python-checkins] python/dist/src/Lib/test test_b1.py,1.55,1.56

doerwalter@users.sourceforge.net doerwalter@users.sourceforge.net
Wed, 06 Nov 2002 08:15:44 -0800


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

Modified Files:
	test_b1.py 
Log Message:
Make int("...") return a long if an int would overflow.

Also remove the 512 character limitation for int(u"...") and long(u"...").

This closes SF bug #629989.


Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.55
retrieving revision 1.56
diff -C2 -d -r1.55 -r1.56
*** test_b1.py	8 Oct 2002 21:01:07 -0000	1.55
--- test_b1.py	6 Nov 2002 16:15:10 -0000	1.56
***************
*** 436,443 ****
  try:
      int(s[1:])
! except ValueError:
!     pass
! else:
!     raise TestFailed, "int(%s)" % `s[1:]` + " should raise ValueError"
  try:
      int(1e100)
--- 436,441 ----
  try:
      int(s[1:])
! except:
!     raise TestFailed, "int(%s)" % `s[1:]` + " should return long"
  try:
      int(1e100)
***************
*** 469,475 ****
  else: raise TestFailed("int('53', 40) didn't raise ValueError")
  
! try: int('1' * 512)
! except ValueError: pass
! else: raise TestFailed("int('1' * 512) didn't raise ValueError")
  
  try: int(1, 12)
--- 467,476 ----
  else: raise TestFailed("int('53', 40) didn't raise ValueError")
  
! try: int('1' * 600)
! except: raise TestFailed("int('1' * 600) didn't return long")
! 
! if have_unicode:
! 	try: int(unichr(0x661) * 600)
! 	except: raise TestFailed("int('\\u0661' * 600) didn't return long")
  
  try: int(1, 12)