summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2002-08-29 14:22:51 (GMT)
committerRaymond Hettinger <python@rcn.com>2002-08-29 14:22:51 (GMT)
commit604cd6ae79e0e7ff52b96bba9aa9fbd6c21e1e8f (patch)
tree27b2038b8e2cf8bec7908a467a3e1e68655f243a /Lib/test
parent18bd11205d5a477e9be9cd70a3cbcc7eeae6fc9b (diff)
downloadcpython-604cd6ae79e0e7ff52b96bba9aa9fbd6c21e1e8f.zip
cpython-604cd6ae79e0e7ff52b96bba9aa9fbd6c21e1e8f.tar.gz
cpython-604cd6ae79e0e7ff52b96bba9aa9fbd6c21e1e8f.tar.bz2
complex() was the only numeric constructor that created a new instance
when given its own type as an argument.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_b1.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_b1.py b/Lib/test/test_b1.py
index d80767b..5536246 100644
--- a/Lib/test/test_b1.py
+++ b/Lib/test/test_b1.py
@@ -140,6 +140,10 @@ 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")'
+c = 3.14 + 1j
+if complex(c) is not c: raise TestFailed, 'complex(3.14+1j) changed identity'
+del c
+
try: complex("1", "1")
except TypeError: pass
else: raise TestFailed, 'complex("1", "1")'