[Python-checkins] CVS: python/dist/src/Lib/test test_b2.py,1.29,1.30

Neal Norwitz nnorwitz@users.sourceforge.net
Fri, 28 Dec 2001 16:16:11 -0800


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

Modified Files:
	test_b2.py 
Log Message:
SF Patch #494876, test invalid parameters to pow()

Index: test_b2.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b2.py,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** test_b2.py	2001/12/07 18:21:56	1.29
--- test_b2.py	2001/12/29 00:16:09	1.30
***************
*** 106,109 ****
--- 106,129 ----
                      raise TestFailed, 'pow(%s, %s, %s)' % (x, y, z)
  
+ try: pow(-1, -2, 3)
+ except TypeError: pass
+ else: raise TestFailed, 'pow(1, -2, 3) should raise TypeError'
+ 
+ try: pow(1, 2, 0)
+ except ValueError: pass
+ else: raise TestFailed, 'pow(1, 2, 0) should raise ValueError'
+ 
+ try: pow(-1L, -2L, 3L)
+ except TypeError: pass
+ else: raise TestFailed, 'pow(1L, -2L, 3L) should raise TypeError'
+ 
+ try: pow(1L, 2L, 0L)
+ except ValueError: pass
+ else: raise TestFailed, 'pow(1L, 2L, 0L) should raise ValueError'
+ 
+ try: pow(-342.43, 0.234)
+ except ValueError: pass
+ else: raise TestFailed, 'pow(-342.43, 0.234) should raise ValueError'
+ 
  print 'range'
  if range(3) != [0, 1, 2]: raise TestFailed, 'range(3)'