Skip to content

Commit 2f1e4aa

Browse files
committed
Update test
1 parent e65279d commit 2f1e4aa

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

Lib/test/test_listcomps.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -711,12 +711,15 @@ def test_multiple_comprehension_name_reuse(self):
711711

712712
def test_name_collision_locals(self):
713713
code = """
714-
x = 1
715-
[x for x in [0]]
714+
import sys
715+
frame = sys._getframe()
716+
f_locals = frame.f_locals
717+
foo = 1
718+
[foo for foo in [0]]
716719
from abc import *
717-
exec("b = 2")
720+
assert frame.f_locals is f_locals
718721
"""
719-
self._check_in_scopes(code, {"b": 2, "x": 1}, scopes=["module"])
722+
self._check_in_scopes(code, {"foo": 1}, scopes=["module"])
720723

721724
def test_exception_locations(self):
722725
# The location of an exception raised from __init__ or

0 commit comments

Comments
 (0)