[Python-checkins] CVS: python/dist/src/Lib/test test_b2.py,1.14,1.15 test_long.py,1.2,1.3 test_pow.py,1.3,1.4

Fred L. Drake fdrake@weyr.cnri.reston.va.us
Thu, 23 Dec 1999 10:36:46 -0500 (EST)


Update of /projects/cvsroot/python/dist/src/Lib/test
In directory weyr:/home/fdrake/projects/python/Lib/test

Modified Files:
	test_b2.py test_long.py test_pow.py 
Log Message:

Revise tests to support str(<long int object>) not appending "L".


Index: test_b2.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_b2.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** test_b2.py	1998/05/22 15:05:36	1.14
--- test_b2.py	1999/12/23 15:36:42	1.15
***************
*** 210,214 ****
  if str('') <> '': raise TestFailed, 'str(\'\')'
  if str(0) <> '0': raise TestFailed, 'str(0)'
! if str(0L) <> '0L': raise TestFailed, 'str(0L)'
  if str(()) <> '()': raise TestFailed, 'str(())'
  if str([]) <> '[]': raise TestFailed, 'str([])'
--- 210,214 ----
  if str('') <> '': raise TestFailed, 'str(\'\')'
  if str(0) <> '0': raise TestFailed, 'str(0)'
! if str(0L) <> '0': raise TestFailed, 'str(0L)'
  if str(()) <> '()': raise TestFailed, 'str(())'
  if str([]) <> '[]': raise TestFailed, 'str([])'

Index: test_long.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_long.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** test_long.py	1998/10/02 01:19:46	1.2
--- test_long.py	1999/12/23 15:36:42	1.3
***************
*** 160,164 ****
              test_bitop_identities_3(x, y, getran((lenx + leny)/2))
  
! # ------------------------------------------------------ hex oct str atol
  
  def slow_format(x, base):
--- 160,164 ----
              test_bitop_identities_3(x, y, getran((lenx + leny)/2))
  
! # ------------------------------------------------- hex oct repr str atol
  
  def slow_format(x, base):
***************
*** 182,186 ****
  def test_format_1(x):
      from string import atol
!     for base, mapper in (8, oct), (10, str), (16, hex):
          got = mapper(x)
          expected = slow_format(x, base)
--- 182,186 ----
  def test_format_1(x):
      from string import atol
!     for base, mapper in (8, oct), (10, repr), (16, hex):
          got = mapper(x)
          expected = slow_format(x, base)
***************
*** 188,191 ****
--- 188,197 ----
                got, "but expected", expected, "for", x)
          check(atol(got, 0) == x, 'atol("%s", 0) !=' % got, x)
+     # str() has to be checked a little differently since there's no
+     # trailing "L"
+     got = str(x)
+     expected = slow_format(x, 10)[:-1]
+     check(got == expected, mapper.__name__, "returned",
+           got, "but expected", expected, "for", x)
  
  def test_format(maxdigits=MAXDIGITS):

Index: test_pow.py
===================================================================
RCS file: /projects/cvsroot/python/dist/src/Lib/test/test_pow.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** test_pow.py	1998/03/26 19:42:30	1.3
--- test_pow.py	1999/12/23 15:36:42	1.4
***************
*** 57,74 ****
  
  print 'The number in both columns should match.'
! print pow(3,3) % 8, pow(3,3,8)
! print pow(3,3) % -8, pow(3,3,-8)
! print pow(3,2) % -2, pow(3,2,-2)
! print pow(-3,3) % 8, pow(-3,3,8)
! print pow(-3,3) % -8, pow(-3,3,-8)
! print pow(5,2) % -8, pow(5,2,-8)
  print
  
! print pow(3L,3L) % 8, pow(3L,3L,8)
! print pow(3L,3L) % -8, pow(3L,3L,-8)
! print pow(3L,2) % -2, pow(3L,2,-2)
! print pow(-3L,3L) % 8, pow(-3L,3L,8)
! print pow(-3L,3L) % -8, pow(-3L,3L,-8)
! print pow(5L,2) % -8, pow(5L,2,-8)
  print
  
--- 57,74 ----
  
  print 'The number in both columns should match.'
! print `pow(3,3) % 8`, `pow(3,3,8)`
! print `pow(3,3) % -8`, `pow(3,3,-8)`
! print `pow(3,2) % -2`, `pow(3,2,-2)`
! print `pow(-3,3) % 8`, `pow(-3,3,8)`
! print `pow(-3,3) % -8`, `pow(-3,3,-8)`
! print `pow(5,2) % -8`, `pow(5,2,-8)`
  print
  
! print `pow(3L,3L) % 8`, `pow(3L,3L,8)`
! print `pow(3L,3L) % -8`, `pow(3L,3L,-8)`
! print `pow(3L,2) % -2`, `pow(3L,2,-2)`
! print `pow(-3L,3L) % 8`, `pow(-3L,3L,8)`
! print `pow(-3L,3L) % -8`, `pow(-3L,3L,-8)`
! print `pow(5L,2) % -8`, `pow(5L,2,-8)`
  print