From: Lisandro Dalcin Date: Fri, 23 Oct 2009 18:41:24 +0000 (-0200) Subject: additional test for type casts (ticket #417) X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=af702c9658c6711c21e2136cec69c11470233fe0;p=cython.git additional test for type casts (ticket #417) --HG-- extra : rebase_source : 3512ea980463bae13f30b0d8bd395cabe253e65c --- diff --git a/tests/run/typetest_T417.pyx b/tests/run/typetest_T417.pyx index fd844ed7..09b1c0bd 100644 --- a/tests/run/typetest_T417.pyx +++ b/tests/run/typetest_T417.pyx @@ -53,3 +53,29 @@ def foo3(arg): TypeError: Cannot convert typetest_T417.Bar to typetest_T417.Foo """ cdef val = 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 = getFoo() + return count - old_count