From: Dag Sverre Seljebotn Date: Sat, 28 Mar 2009 16:12:56 +0000 (+0100) Subject: Testcase for #267 X-Git-Tag: 0.12.alpha0~334^2~5 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=662dc309192f0facf09c68145e84f49bb010b35a;p=cython.git Testcase for #267 --- diff --git a/tests/bugs/ifelseexpr_T267.pyx b/tests/bugs/ifelseexpr_T267.pyx new file mode 100644 index 00000000..096b27ec --- /dev/null +++ b/tests/bugs/ifelseexpr_T267.pyx @@ -0,0 +1,28 @@ +""" +>>> constants(5) +1 +>>> constants(6) +10 +>>> temps(5) +1 +>>> temps(6) +10 +>>> nested(1) +1 +>>> nested(2) +2 +>>> nested(3) +3 +""" + +def ident(x): return x + +def constants(x): + a = 1 if x < 5 else 10 + return a + +def temps(x): + return ident(1) if ident(x) < ident(5) else ident(10) + +def nested(x): + return 1 if x == 1 else (2 if x == 2 else 3)