Skip to content

Incorrect test in test_pyrepl #134214

@tomasr8

Description

@tomasr8

Bug report

Bug description:

In this test:

for code, parsed in cases:
parser = ImportParser(code)
actual = parser.parse()
with self.subTest(code=code):
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):
self.assertEqual(actual, parsed)
code = f'import xyz;{code}'
with self.subTest(code=code):
self.assertEqual(actual, parsed)

The second and third assert is not rerunning the ImportParser so it's not actually testing anything right now.
We need to add this before each call to assert:

parser = ImportParser(code)
actual = parser.parse()

Please don't pick up this issue, I'd like to reserve it for someone at the PyConUS sprints :)

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    easytestsTests in the Lib/test dirtopic-replRelated to the interactive shelltype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions