]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-134214: Fix test case in pyrepl (gh-134223)
authorJessica Temporal <jtemporal@users.noreply.github.com>
Mon, 19 May 2025 14:26:04 +0000 (10:26 -0400)
committerGitHub <noreply@github.com>
Mon, 19 May 2025 14:26:04 +0000 (16:26 +0200)
Lib/test/test_pyrepl/test_pyrepl.py

index f80755b3368f8fc3c8fa840352f550f82c48b737..a1cfbe4c3cadb7310c31cc79d00828d0dc965e67 100644 (file)
@@ -1055,11 +1055,15 @@ class TestPyReplModuleCompleter(TestCase):
                 self.assertEqual(actual, parsed)
             # The parser should not get tripped up by any
             # other preceding statements
-            code = f'import xyz\n{code}'
-            with self.subTest(code=code):
+            _code = f'import xyz\n{code}'
+            parser = ImportParser(_code)
+            actual = parser.parse()
+            with self.subTest(code=_code):
                 self.assertEqual(actual, parsed)
-            code = f'import xyz;{code}'
-            with self.subTest(code=code):
+            _code = f'import xyz;{code}'
+            parser = ImportParser(_code)
+            actual = parser.parse()
+            with self.subTest(code=_code):
                 self.assertEqual(actual, parsed)
 
     def test_parse_error(self):