From: Stefan Behnel Date: Fri, 9 Oct 2009 15:13:14 +0000 (+0200) Subject: some more type inference tests X-Git-Tag: 0.13.beta0~2^2~121^2~97 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=62410bbeb07a93dec0ed6128b380761a180c3870;p=cython.git some more type inference tests --- diff --git a/tests/run/type_inference.pyx b/tests/run/type_inference.pyx index 1f542b5d..1ca2c5d9 100644 --- a/tests/run/type_inference.pyx +++ b/tests/run/type_inference.pyx @@ -62,6 +62,15 @@ def cascade(): e = a + b + c + d assert typeof(e) == "double" +def cascaded_assignment(): + a = b = c = d = 1.0 + assert typeof(a) == "double" + assert typeof(b) == "double" + assert typeof(c) == "double" + assert typeof(d) == "double" + e = a + b + c + d + assert typeof(e) == "double" + def increment(): a = 5 a += 1 @@ -71,10 +80,16 @@ def loop(): for a in range(10): pass assert typeof(a) == "long" + b = 1.0 for b in range(5): pass assert typeof(b) == "double" + for c from 0 <= c < 10 by .5: pass assert typeof(c) == "double" + + for d in range(0, 10L, 2): + pass + assert typeof(a) == "long"