From: Stefan Behnel Date: Fri, 4 Dec 2009 13:04:20 +0000 (+0100) Subject: simple test case for safe double inference X-Git-Tag: 0.12.1~89 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=20f13f93a5e528840c0940872ec8983b69caf62f;p=cython.git simple test case for safe double inference --- diff --git a/tests/run/type_inference.pyx b/tests/run/type_inference.pyx index 3ba8e0bf..ffc03cb2 100644 --- a/tests/run/type_inference.pyx +++ b/tests/run/type_inference.pyx @@ -1,6 +1,7 @@ # cython: infer_types = all +cimport cython from cython cimport typeof, infer_types cdef class MyType: @@ -147,6 +148,23 @@ def loop(): pass assert typeof(a) == "long" + +@cython.test_fail_if_path_exists('//NameNode[@type.is_pyobject = True]') +@cython.test_assert_path_exists('//InPlaceAssignmentNode/NameNode', + '//NameNode[@type.is_pyobject]', + '//NameNode[@type.is_pyobject = False]') +@infer_types('safe') +def double_loop(): + """ + >>> double_loop() == 1.0 * 10 + True + """ + cdef int i + d = 1.0 + for i in range(9): + d += 1.0 + return d + cdef unicode retu(): return u"12345"