Commit 39aa2269 authored by Stefan Behnel's avatar Stefan Behnel

extended test case

parent c333ff19
# mode: run
# tag: condexpr
# ticket: 267 # ticket: 267
""" cimport cython
>>> constants(4)
1
>>> constants(5)
10
>>> temps(4)
1
>>> temps(5)
10
>>> nested(1)
1
>>> nested(2)
2
>>> nested(3)
3
"""
def ident(x): return x def ident(x): return x
def constants(x): def constants(x):
"""
>>> constants(4)
1
>>> constants(5)
10
"""
a = 1 if x < 5 else 10 a = 1 if x < 5 else 10
return a return a
def temps(x): def temps(x):
"""
>>> temps(4)
1
>>> temps(5)
10
"""
return ident(1) if ident(x) < ident(5) else ident(10) return ident(1) if ident(x) < ident(5) else ident(10)
def nested(x): def nested(x):
"""
>>> nested(1)
1
>>> nested(2)
2
>>> nested(3)
3
"""
return 1 if x == 1 else (2 if x == 2 else 3) return 1 if x == 1 else (2 if x == 2 else 3)
def const_true():
"""
>>> const_true()
1
"""
return 1 if 1 == 1 else 2
def const_false():
"""
>>> const_false()
2
"""
return 1 if 1 != 1 else 2
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment