(self)
| 745 | self.assertEqual(list(g(5)), [1, 2, 3, 4, 5]) |
| 746 | |
| 747 | def testNestedNonLocal(self): |
| 748 | |
| 749 | def f(x): |
| 750 | def g(): |
| 751 | nonlocal x |
| 752 | x -= 2 |
| 753 | def h(): |
| 754 | nonlocal x |
| 755 | x += 4 |
| 756 | return x |
| 757 | return h |
| 758 | return g |
| 759 | |
| 760 | g = f(1) |
| 761 | h = g() |
| 762 | self.assertEqual(h(), 3) |
| 763 | |
| 764 | def testTopIsNotSignificant(self): |
| 765 | # See #9997. |
nothing calls this directly
no test coverage detected