mirror of
https://github.com/python/cpython.git
synced 2025-08-24 18:55:00 +00:00
gh-119180: PEP 649 compiler changes (#119361)
This commit is contained in:
parent
02c1dfff07
commit
9b8611eeea
28 changed files with 610 additions and 329 deletions
|
@ -205,12 +205,14 @@ class SymtableTest(unittest.TestCase):
|
|||
|
||||
def test_annotated(self):
|
||||
st1 = symtable.symtable('def f():\n x: int\n', 'test', 'exec')
|
||||
st2 = st1.get_children()[0]
|
||||
st2 = st1.get_children()[1]
|
||||
self.assertEqual(st2.get_type(), "function")
|
||||
self.assertTrue(st2.lookup('x').is_local())
|
||||
self.assertTrue(st2.lookup('x').is_annotated())
|
||||
self.assertFalse(st2.lookup('x').is_global())
|
||||
st3 = symtable.symtable('def f():\n x = 1\n', 'test', 'exec')
|
||||
st4 = st3.get_children()[0]
|
||||
st4 = st3.get_children()[1]
|
||||
self.assertEqual(st4.get_type(), "function")
|
||||
self.assertTrue(st4.lookup('x').is_local())
|
||||
self.assertFalse(st4.lookup('x').is_annotated())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue