From 20f13f93a5e528840c0940872ec8983b69caf62f Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 4 Dec 2009 14:04:20 +0100 Subject: [PATCH] simple test case for safe double inference --- tests/run/type_inference.pyx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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" -- 2.26.2