(self)
| 956 | """) |
| 957 | |
| 958 | def test_invalid_syntax(self): |
| 959 | script = dedent(""" |
| 960 | x = 1 + 2 |
| 961 | y = 2 + 4 |
| 962 | z = 4 + 8 |
| 963 | |
| 964 | # missing close paren |
| 965 | print("spam" |
| 966 | |
| 967 | if x + y + z < 20: |
| 968 | ... |
| 969 | """) |
| 970 | |
| 971 | with self.subTest('script'): |
| 972 | with self.assertRaises(SyntaxError): |
| 973 | _interpreters.run_string(self.id, script) |
| 974 | |
| 975 | with self.subTest('module'): |
| 976 | modname = 'spam_spam_spam' |
| 977 | filename = self.add_module(modname, script) |
| 978 | self.assert_run_failed(SyntaxError, f""" |
| 979 | import {modname} |
| 980 | """) |
| 981 | |
| 982 | def test_NameError(self): |
| 983 | self.assert_run_failed(NameError, """ |
nothing calls this directly
no test coverage detected