[Python-checkins] CVS: python/dist/src/Lib/test test_b1.py,1.41,1.42

Fred L. Drake fdrake@users.sourceforge.net
Thu, 13 Dec 2001 11:52:06 -0800


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

Modified Files:
	test_b1.py 
Log Message:
Ensure that complex() only accepts a string argument as the first arg,
and only if there is no second arg.
This closes SF patch #479551.


Index: test_b1.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_b1.py,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** test_b1.py	2001/12/11 04:37:34	1.41
--- test_b1.py	2001/12/13 19:52:03	1.42
***************
*** 123,126 ****
--- 123,134 ----
  if complex(0j, 3.14) != 3.14j: raise TestFailed, 'complex(0j, 3.14)'
  if complex(0.0, 3.14) != 3.14j: raise TestFailed, 'complex(0.0, 3.14)'
+ if complex("1") != 1+0j: raise TestFailed, 'complex("1")'
+ if complex("1j") != 1j: raise TestFailed, 'complex("1j")'
+ try: complex("1", "1")
+ except TypeError: pass
+ else: raise TestFailed, 'complex("1", "1")'
+ try: complex(1, "1")
+ except TypeError: pass
+ else: raise TestFailed, 'complex(1, "1")'
  if complex("  3.14+J  ") != 3.14+1j:  raise TestFailed, 'complex("  3.14+J  )"'
  if have_unicode: