diff options
author | Ivan Levkivskyi <levkivskyi@gmail.com> | 2019-01-25 01:39:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-25 01:39:19 (GMT) |
commit | 62c35a8a8ff5854ed470b1c16a7a14f3bb80368c (patch) | |
tree | c9fbcd76316803a7d1272301a64a3c3ea233d2bd /Lib/test/test_grammar.py | |
parent | 1396d8fab4d0ae830d45f4937322bbb43ce0c30e (diff) | |
download | cpython-62c35a8a8ff5854ed470b1c16a7a14f3bb80368c.zip cpython-62c35a8a8ff5854ed470b1c16a7a14f3bb80368c.tar.gz cpython-62c35a8a8ff5854ed470b1c16a7a14f3bb80368c.tar.bz2 |
bpo-35814: Allow same r.h.s. in annotated assignments as in normal ones (GH-11667)
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r-- | Lib/test/test_grammar.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 3ed19ff..74590eb 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -445,6 +445,15 @@ class GrammarTests(unittest.TestCase): exec('X: str', {}, CNS2()) self.assertEqual(nonloc_ns['__annotations__']['x'], str) + def test_var_annot_rhs(self): + ns = {} + exec('x: tuple = 1, 2', ns) + self.assertEqual(ns['x'], (1, 2)) + stmt = ('def f():\n' + ' x: int = yield') + exec(stmt, ns) + self.assertEqual(list(ns['f']()), [None]) + def test_funcdef(self): ### [decorators] 'def' NAME parameters ['->' test] ':' suite ### decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE |