additional test for type casts (ticket #417)
authorLisandro Dalcin <dalcinl@gmail.com>
Fri, 23 Oct 2009 18:41:24 +0000 (16:41 -0200)
committerLisandro Dalcin <dalcinl@gmail.com>
Fri, 23 Oct 2009 18:41:24 +0000 (16:41 -0200)
--HG--
extra : rebase_source : 3512ea980463bae13f30b0d8bd395cabe253e65c

tests/run/typetest_T417.pyx

index fd844ed7a8fa94b2ff5a388fbfc638c06bc3c6a4..09b1c0bd061dc1f93b728a9c615701817e89df6d 100644 (file)
@@ -53,3 +53,29 @@ def foo3(arg):
     TypeError: Cannot convert typetest_T417.Bar to typetest_T417.Foo
     """
     cdef val = <Foo?>arg
+
+
+cdef int count = 0
+
+cdef object getFoo():
+     global count
+     count += 1
+     return Foo()
+
+def test_getFoo():
+    """
+    >>> test_getFoo()
+    1
+    """
+    cdef int old_count = count
+    cdef Foo x = getFoo()
+    return count - old_count
+
+def test_getFooCast():
+    """
+    >>> test_getFooCast()
+    1
+    """
+    cdef int old_count = count
+    cdef Foo x = <Foo?>getFoo()
+    return count - old_count