Skip to content

Incorrect test in test_pyrepl #134214

Closed
Closed
@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

Activity

added
type-bugAn unexpected behavior, bug, or error
testsTests in the Lib/test dir
topic-replRelated to the interactive shell
on May 19, 2025
jtemporal

jtemporal commented on May 19, 2025

@jtemporal
Contributor

I'm on it 👋

tomasr8

tomasr8 commented on May 19, 2025

@tomasr8
MemberAuthor

@jtemporal Let me know if you need help, I'm in the other room (316) 🙂

added a commit that references this issue on May 19, 2025

pythongh-134214: Fix test case in pyrepl

StanFromIreland

StanFromIreland commented on May 19, 2025

@StanFromIreland
Contributor

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

There is a sprint label for just that:-)

added a commit that references this issue on May 19, 2025

gh-134214: Fix test case in pyrepl (gh-134223)

faebf87
added a commit that references this issue on May 19, 2025

pythongh-134214: Fix test case in pyrepl (pythongh-134223)

added a commit that references this issue on May 19, 2025

[3.14] gh-134214: Fix test case in pyrepl (gh-134223) (gh-134229)

7d995ea
tomasr8

tomasr8 commented on May 19, 2025

@tomasr8
MemberAuthor

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

There is a sprint label for just that:-)

I asked about it and was told to use the easy label, but maybe also adding the sprint label wouldn't hurt?

tomasr8

tomasr8 commented on May 19, 2025

@tomasr8
MemberAuthor

Thanks @jtemporal !!

2 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      Incorrect test in `test_pyrepl` · Issue #134214 · python/cpython

      Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

      Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant