]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Add tests for float() and complex() with string args (Nick/Stephanie
authorGuido van Rossum <guido@python.org>
Thu, 25 Mar 1999 21:25:01 +0000 (21:25 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 25 Mar 1999 21:25:01 +0000 (21:25 +0000)
Lockwood).

Lib/test/test_b1.py

index 7155294e8f1d01f57211393625c317d05de531f2..d9c6320cd32d4563b4656efc4fe0dce6f79e82b8 100644 (file)
@@ -94,6 +94,7 @@ if complex(0j, 3.14j) <> -3.14+0j: raise TestFailed, 'complex(0j, 3.14j)'
 if complex(0.0, 3.14j) <> -3.14+0j: raise TestFailed, 'complex(0.0, 3.14j)'
 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("  3.14+J  ") <> 3.14+1j:  raise TestFailed, 'complex("  3.14+J  )"'
 class Z:
     def __complex__(self): return 3.14j
 z = Z()
@@ -206,6 +207,7 @@ print 'float'
 if float(3.14) <> 3.14: raise TestFailed, 'float(3.14)'
 if float(314) <> 314.0: raise TestFailed, 'float(314)'
 if float(314L) <> 314.0: raise TestFailed, 'float(314L)'
+if float("  3.14  ") <> 3.14:  raise TestFailed, 'float("  3.14  ")'
 
 print 'getattr'
 import sys