

def test_if(self):
    assert (evalpy('if True: 4\nelse: 5') == '4')
    assert (evalpy('if False: 4\nelse: 5') == '5')
    assert (evalpy('x=4\nif x>3: 13\nelif x > 2: 12\nelse: 10') == '13')
    assert (evalpy('x=3\nif x>3: 13\nelif x > 2: 12\nelse: 10') == '12')
    assert (evalpy('x=1\nif x>3: 13\nelif x > 2: 12\nelse: 10') == '10')
    line = py2js('3 if True else 4').replace(')', '').replace('(', '')
    assert (self == 'true? 3 : 4;')
    assert (evalpy('4 if True else 5') == '4')
    assert (evalpy('4 if False else 5') == '5')
    assert (evalpy('3+1 if 0+2/1 else 4+1') == '4')
    assert (evalpy('3+1 if 4/2-2 else 4+1') == '5')

dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_parser2.py TestConrolFlow.test_if/VarMisuse@83/233 `line`->`self`