cython-devel
changeset 2571:9f4f888a2b4e
additional test for type casts (ticket #417)
| author | Lisandro Dalcin <dalcinl@gmail.com> |
|---|---|
| date | Fri Oct 23 16:41:24 2009 -0200 (2 years ago) |
| parents | 294a197230dd |
| children | c798ca30c65f |
| files | tests/run/typetest_T417.pyx |
line diff
1.1 --- a/tests/run/typetest_T417.pyx Thu Oct 22 18:42:30 2009 -0200
1.2 +++ b/tests/run/typetest_T417.pyx Fri Oct 23 16:41:24 2009 -0200
1.3 @@ -53,3 +53,29 @@
1.4 TypeError: Cannot convert typetest_T417.Bar to typetest_T417.Foo
1.5 """
1.6 cdef val = <Foo?>arg
1.7 +
1.8 +
1.9 +cdef int count = 0
1.10 +
1.11 +cdef object getFoo():
1.12 + global count
1.13 + count += 1
1.14 + return Foo()
1.15 +
1.16 +def test_getFoo():
1.17 + """
1.18 + >>> test_getFoo()
1.19 + 1
1.20 + """
1.21 + cdef int old_count = count
1.22 + cdef Foo x = getFoo()
1.23 + return count - old_count
1.24 +
1.25 +def test_getFooCast():
1.26 + """
1.27 + >>> test_getFooCast()
1.28 + 1
1.29 + """
1.30 + cdef int old_count = count
1.31 + cdef Foo x = <Foo?>getFoo()
1.32 + return count - old_count
