MCPcopy Index your code
hub / github.com/python/cpython / test_lambdas_with_free_var

Method test_lambdas_with_free_var

Lib/test/test_listcomps.py:143–149  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

141 self._check_in_scopes(code, outputs)
142
143 def test_lambdas_with_free_var(self):
144 code = """
145 items = [(lambda: i) for i in range(5)]
146 y = [x() for x in items]
147 """
148 outputs = {"y": [4, 4, 4, 4, 4]}
149 self._check_in_scopes(code, outputs)
150
151 def test_class_scope_free_var_with_class_cell(self):
152 class C:

Callers

nothing calls this directly

Calls 1

_check_in_scopesMethod · 0.95

Tested by

no test coverage detected