def assert_incomplete(self, s): """Assert that s fails to parse with UnexpectedEndError. (This should be the case if `s` is a prefix of a valid Script.) """ self.assertRaises(jsparagus.lexer.UnexpectedEndError, lambda: parse_Script(s))
def parse(self, s): if isinstance(s, list): f = JSLexer(JSParser()) for chunk in s: f.write(chunk) return f.close() else: return parse_Script(s)
def assert_syntax_error(self, s): """Assert that s fails to parse.""" with self.assertRaises(jsparagus.lexer.SyntaxError): parse_Script(s)