Skip to content

gh-126332: Add tests for _pyrepl.utils - #129325

Merged
vstinner merged 9 commits into
python:mainfrom
eendebakpt:pyrepl_utils
Feb 21, 2025
Merged

gh-126332: Add tests for _pyrepl.utils#129325
vstinner merged 9 commits into
python:mainfrom
eendebakpt:pyrepl_utils

Conversation

@eendebakpt

@eendebakpteendebakpt commented Jan 26, 2025

Copy link
Copy Markdown
Contributor

Add unit tests for methods 'wlen and str_width from _pyrepl.utils.

@AlexWaygoodAlexWaygood changed the title gh-126332: Add tests for _pyrepr.utilsgh-126332: Add tests for _pyrepl.utilsJan 26, 2025
Comment threadLib/test/test_pyrepl/test_utils.py Outdated

self.assertEqual(wlen('hello'), 5)
self.assertEqual(wlen('hello'+'\x1a'), 7)
self.assertEqual(wlen('hello'+'\0x1B'), 9)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is strange. Are you testing the nul byte and then the stringx1B on purpose?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I tried to create a special unicode character to hit one of the paths in wlen, but think I made a typo. I removed this test and added two others.

@vstinnervstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner

Copy link
Copy Markdown
Member

The Docs CI job fails, I'm not sure why. So I updated the branch to try to fix the issue.

@vstinner
vstinner merged commit 0c4248f into python:mainFeb 21, 2025
@vstinnervstinner added the needs backport to 3.13 bugs and security fixes label Feb 21, 2025
@miss-islington-app

Copy link
Copy Markdown

Thanks @eendebakpt for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 21, 2025
(cherry picked from commit 0c4248f)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
@bedevere-app

Copy link
Copy Markdown

GH-130414 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appBot removed the needs backport to 3.13 bugs and security fixes label Feb 21, 2025
vstinner pushed a commit that referenced this pull request Feb 21, 2025
gh-126332: Add tests for _pyrepl.utils (GH-129325)
(cherry picked from commit 0c4248f)
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip newstestsTests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@eendebakpt@vstinner@tomasr8