summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_listcomps.py
diff options
context:
space:
mode:
authorTian Gao <gaogaotiantian@hotmail.com>2024-05-04 11:12:10 (GMT)
committerGitHub <noreply@github.com>2024-05-04 11:12:10 (GMT)
commitb034f14a4b6e9197d3926046721b8b4b4b4f5b3d (patch)
tree2d641189f3401526d264d13e5b855c576c29dc63 /Lib/test/test_listcomps.py
parent1ab6356ebec25f216a0eddbd81225abcb93f2d55 (diff)
downloadcpython-b034f14a4b6e9197d3926046721b8b4b4b4f5b3d.zip
cpython-b034f14a4b6e9197d3926046721b8b4b4b4f5b3d.tar.gz
cpython-b034f14a4b6e9197d3926046721b8b4b4b4f5b3d.tar.bz2
gh-74929: Implement PEP 667 (GH-115153)
Diffstat (limited to 'Lib/test/test_listcomps.py')
-rw-r--r--Lib/test/test_listcomps.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_listcomps.py b/Lib/test/test_listcomps.py
index df1debf..ec2aac8 100644
--- a/Lib/test/test_listcomps.py
+++ b/Lib/test/test_listcomps.py
@@ -622,9 +622,14 @@ class ListComprehensionTest(unittest.TestCase):
def test_frame_locals(self):
code = """
- val = [sys._getframe().f_locals for a in [0]][0]["a"]
+ val = "a" in [sys._getframe().f_locals for a in [0]][0]
"""
import sys
+ self._check_in_scopes(code, {"val": False}, ns={"sys": sys})
+
+ code = """
+ val = [sys._getframe().f_locals["a"] for a in [0]][0]
+ """
self._check_in_scopes(code, {"val": 0}, ns={"sys": sys})
def _recursive_replace(self, maybe_code):