(self)
| 623 | self.get_identifiers_recursive(ch, res) |
| 624 | |
| 625 | def test_loopvar_in_only_one_scope(self): |
| 626 | # ensure that the loop variable appears only once in the symtable |
| 627 | comps = [ |
| 628 | "[x for x in [1]]", |
| 629 | "{x for x in [1]}", |
| 630 | "{x:x*x for x in [1]}", |
| 631 | ] |
| 632 | for comp in comps: |
| 633 | with self.subTest(comp=comp): |
| 634 | st = symtable.symtable(comp, "?", "exec") |
| 635 | ids = [] |
| 636 | self.get_identifiers_recursive(st, ids) |
| 637 | self.assertEqual(len([x for x in ids if x == 'x']), 1) |
| 638 | |
| 639 | |
| 640 | class CommandLineTest(unittest.TestCase): |
nothing calls this directly
no test coverage detected