mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
gh-108983: Add more PEP 526 tests to test_grammar
(#108984)
This commit is contained in:
parent
39376cb93d
commit
1fb20d42c5
1 changed files with 11 additions and 0 deletions
|
@ -350,6 +350,11 @@ class GrammarTests(unittest.TestCase):
|
|||
check_syntax_error(self, "x: int: str")
|
||||
check_syntax_error(self, "def f():\n"
|
||||
" nonlocal x: int\n")
|
||||
check_syntax_error(self, "def f():\n"
|
||||
" global x: int\n")
|
||||
check_syntax_error(self, "x: int = y = 1")
|
||||
check_syntax_error(self, "z = w: int = 1")
|
||||
check_syntax_error(self, "x: int = y: int = 1")
|
||||
# AST pass
|
||||
check_syntax_error(self, "[x, 0]: int\n")
|
||||
check_syntax_error(self, "f(): int\n")
|
||||
|
@ -363,6 +368,12 @@ class GrammarTests(unittest.TestCase):
|
|||
check_syntax_error(self, "def f():\n"
|
||||
" global x\n"
|
||||
" x: int\n")
|
||||
check_syntax_error(self, "def f():\n"
|
||||
" x: int\n"
|
||||
" nonlocal x\n")
|
||||
check_syntax_error(self, "def f():\n"
|
||||
" nonlocal x\n"
|
||||
" x: int\n")
|
||||
|
||||
def test_var_annot_basic_semantics(self):
|
||||
# execution order
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue