From 62410bbeb07a93dec0ed6128b380761a180c3870 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 9 Oct 2009 17:13:14 +0200 Subject: [PATCH] some more type inference tests --- tests/run/type_inference.pyx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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" -- 2.26.2