MCPcopy Index your code
hub / github.com/RustPython/RustPython / check_syntax_error

Function check_syntax_error

Lib/test/support/__init__.py:739–748  ·  view source on GitHub ↗
(testcase, statement, errtext='', *, lineno=None, offset=None)

Source from the content-addressed store, hash-verified

737
738
739def check_syntax_error(testcase, statement, errtext='', *, lineno=None, offset=None):
740 with testcase.assertRaisesRegex(SyntaxError, errtext) as cm:
741 compile(statement, '<test string>', 'exec')
742 err = cm.exception
743 testcase.assertIsNotNone(err.lineno)
744 if lineno is not None:
745 testcase.assertEqual(err.lineno, lineno)
746 testcase.assertIsNotNone(err.offset)
747 if offset is not None:
748 testcase.assertEqual(err.offset, offset)
749
750
751def open_urlresource(url, *args, **kw):

Callers 15

test_funcdefMethod · 0.90
test_lambdefMethod · 0.90
test_expr_stmtMethod · 0.90
test_returnMethod · 0.90
test_yieldMethod · 0.90
test_listcompsMethod · 0.90
test_genexpsMethod · 0.90
test1Method · 0.90
test2Method · 0.90

Calls 4

assertRaisesRegexMethod · 0.80
assertIsNotNoneMethod · 0.80
compileFunction · 0.50
assertEqualMethod · 0.45

Tested by 15

test_funcdefMethod · 0.72
test_lambdefMethod · 0.72
test_expr_stmtMethod · 0.72
test_returnMethod · 0.72
test_yieldMethod · 0.72
test_listcompsMethod · 0.72
test_genexpsMethod · 0.72
test1Method · 0.72
test2Method · 0.72