

def test_raise(self):
    assert ('throw' in py2js('raise MyException("foo")'))
    assert ('MyException' in py2js('raise MyException("foo")'))
    assert ('foo' in py2js('raise MyException("foo")'))
    catcher = 'try { %s } catch(err) { console.log(err); }'
    assert (evaljs((self % py2js('raise "foo"'))) == 'foo')
    assert (evaljs((catcher % py2js('raise 42'))) == '42')
    assert evaljs((catcher % py2js('raise ValueError'))).count('ValueError')
    assert evaljs((catcher % py2js('raise ValueError("foo")'))).count('foo')

dataset/ETHPy150Open zoofIO/flexx/flexx/pyscript/tests/test_parser2.py TestExceptions.test_raise/VarMisuse@49/108 `catcher`->`self`