Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 21, 2025
Merged

Conversation

eendebakpt
Copy link
Contributor

@eendebakpt eendebakpt commented Jan 26, 2025

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

@AlexWaygood AlexWaygood changed the title gh-126332: Add tests for _pyrepr.utils gh-126332: Add tests for _pyrepl.utils Jan 26, 2025

self.assertEqual(wlen('hello'), 5)
self.assertEqual(wlen('hello'+'\x1a'), 7)
self.assertEqual(wlen('hello'+'\0x1B'), 9)
Copy link
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 string x1B on purpose?

Copy link
Contributor Author

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.

Copy link
Member

@vstinner vstinner left a comment

Choose a reason for hiding this comment

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

LGTM

@vstinner vstinner enabled auto-merge (squash) February 21, 2025 14:32
@vstinner
Copy link
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:main Feb 21, 2025
39 checks passed
@vstinner vstinner added the needs backport to 3.13 bugs and security fixes label Feb 21, 2025
@miss-islington-app
Copy link

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 <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 21, 2025

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

@bedevere-app bedevere-app bot 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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants