MCPcopy Index your code
hub / github.com/python/cpython / assert_syntax_error

Method assert_syntax_error

Lib/test/test_patma.py:2894–2896  ·  view source on GitHub ↗
(self, code: str)

Source from the content-addressed store, hash-verified

2892class TestSyntaxErrors(unittest.TestCase):
2893
2894 def assert_syntax_error(self, code: str):
2895 with self.assertRaises(SyntaxError):
2896 compile(inspect.cleandoc(code), "<test>", "exec")
2897
2898 def test_alternative_patterns_bind_different_names_0(self):
2899 self.assert_syntax_error("""

Calls 2

compileFunction · 0.50
assertRaisesMethod · 0.45

Tested by

no test coverage detected