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

Method test_var_annot_syntax_errors

Lib/test/test_grammar.py:303–332  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

301 self.assertEqual(my_lst, [5])
302
303 def test_var_annot_syntax_errors(self):
304 # parser pass
305 check_syntax_error(self, "def f: int")
306 check_syntax_error(self, "x: int: str")
307 check_syntax_error(self, "def f():\n"
308 " nonlocal x: int\n")
309 check_syntax_error(self, "def f():\n"
310 " global x: int\n")
311 check_syntax_error(self, "x: int = y = 1")
312 check_syntax_error(self, "z = w: int = 1")
313 check_syntax_error(self, "x: int = y: int = 1")
314 # AST pass
315 check_syntax_error(self, "[x, 0]: int\n")
316 check_syntax_error(self, "f(): int\n")
317 check_syntax_error(self, "(x,): int")
318 check_syntax_error(self, "def f():\n"
319 " (x, y): int = (1, 2)\n")
320 # symtable pass
321 check_syntax_error(self, "def f():\n"
322 " x: int\n"
323 " global x\n")
324 check_syntax_error(self, "def f():\n"
325 " global x\n"
326 " x: int\n")
327 check_syntax_error(self, "def f():\n"
328 " x: int\n"
329 " nonlocal x\n")
330 check_syntax_error(self, "def f():\n"
331 " nonlocal x\n"
332 " x: int\n")
333
334 def test_var_annot_basic_semantics(self):
335 # execution order

Callers

nothing calls this directly

Calls 1

check_syntax_errorFunction · 0.90

Tested by

no test coverage detected