extended test case
authorStefan Behnel <scoder@users.berlios.de>
Sat, 4 Dec 2010 09:46:51 +0000 (10:46 +0100)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 4 Dec 2010 09:46:51 +0000 (10:46 +0100)
tests/run/builtincomplex.pyx

index 603611753ac270616e5691dcffb6742a42fbbc69..90a24b4879db8b797d127b09736a2aeaac0e95f2 100644 (file)
@@ -27,3 +27,13 @@ def complex_cstruct_assign():
     cval = &c.cval
     cval.real, cval.imag = 10, 20
     return (c.real, c.imag)
+
+def complex_coercion():
+    """
+    >>> complex_coercion()
+    (1.0, 2.0, 1.0, 2.0)
+    """
+    cdef complex py_c = 1+2j
+    cdef double complex c_c = py_c
+    cdef object py = c_c
+    return (c_c.real, c_c.imag, py.real, py.imag)