

def test_func_calls(self):
    assert (py2js('foo()') == 'foo();')
    assert (py2js('foo(3, 4)') == 'foo(3, 4);')
    assert (py2js('foo(3, 4+1)') == 'foo(3, 4 + 1);')
    assert py2js('foo(3, *args)')
    assert py2js('a.foo(3, *args)')
    raises(JSError, py2js, 'foo(x=1, y=2)')
    raises(JSError, py2js, 'foo(**kwargs)')
    code = "def foo(x): return x + 1\nd = {'foo':foo}\n"
    assert (evalpy((code + 'foo(3)')) == '4')
    assert (evalpy((code + 'd.foo(3)')) == '4')
    code = "def foo(x, *xx): return x + sum(xx)\nd = {'foo':foo}\nfive=[2, 3]\n"
    assert (evalpy((code + 'foo(1, 2, 3)')) == '6')
    assert (evalpy((code + 'd.foo(1, 2, 3)')) == '6')
    assert (evalpy((code + 'foo(1, *five)')) == '6')
    assert (evalpy((code + 'd.foo(1, *five)')) == '6')

dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_parser2.py TestFunctions.test_func_calls/original