

def test_default_args(self):

    def func(self, foo, bar=2):
        return (foo - bar)
    code = py2js(func)
    lines = [line for line in code.split('\n') if line]
    assert (lines[1] == 'func = function (foo, bar) {')
    assert ('2' in code)
    assert (evaljs((code + 'func(2)')) == '0')
    assert (evaljs((code + 'func(4, 3)')) == '1')
    assert (evaljs((code + 'func(0, 0)')) == '0')

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