Skip to content

Increase test coverage of gettext #130655

New issue

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

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

Already on GitHub? # to your account

Open
tomasr8 opened this issue Feb 27, 2025 · 7 comments
Open

Increase test coverage of gettext #130655

tomasr8 opened this issue Feb 27, 2025 · 7 comments
Assignees
Labels
tests Tests in the Lib/test dir triaged The issue has been accepted as valid by a triager.

Comments

@tomasr8
Copy link
Member

tomasr8 commented Feb 27, 2025

The test coverage for these functions is low as there are no dedicated tests for them. I propose we add tests for these functions.
This will come in handy if/when we decide to fix #64243.

Linked PRs

@StanFromIreland
Copy link
Contributor

I'll open a PR for find sometime tomorrow :-)

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 28, 2025
…thonGH-130656)

(cherry picked from commit 24c52cb)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 28, 2025
…thonGH-130656)

(cherry picked from commit 24c52cb)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
serhiy-storchaka pushed a commit that referenced this issue Feb 28, 2025
…H-130656) (GH-130672)

(cherry picked from commit 24c52cb)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
serhiy-storchaka pushed a commit that referenced this issue Feb 28, 2025
…H-130656) (GH-130671)

(cherry picked from commit 24c52cb)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
@encukou encukou added tests Tests in the Lib/test dir and removed docs Documentation in the Doc dir labels Feb 28, 2025
@picnixz picnixz added the triaged The issue has been accepted as valid by a triager. label Mar 1, 2025
encukou pushed a commit that referenced this issue Mar 19, 2025
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
@encukou
Copy link
Member

encukou commented Mar 19, 2025

Thanks for the tests!
Do you want to add more, or should this be closed?

@tomasr8
Copy link
Member Author

tomasr8 commented Mar 19, 2025

Up to you, IIRC there are some code paths related to parsing MO files which are also not covered. I was going to send a PR for that at some point, but that can also be done in a separate issue if you prefer to close this one.

colesbury pushed a commit to colesbury/cpython that referenced this issue Mar 20, 2025
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
@tomasr8 tomasr8 changed the title Increase test coverage of gettext.find and gettext._expand_lang Increase test coverage of gettext Mar 30, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 4, 2025
…ed by `gettext` (pythonGH-131909)

(cherry picked from commit 16a6270)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 4, 2025
…ed by `gettext` (pythonGH-131909)

(cherry picked from commit 16a6270)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 4, 2025
…honGH-131911)

(cherry picked from commit a126cef)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 4, 2025
(cherry picked from commit 3118693)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Apr 4, 2025
(cherry picked from commit 3118693)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
picnixz pushed a commit that referenced this issue Apr 4, 2025
gh-130655: Add tests for `gettext.find()` (GH-130691)

(cherry picked from commit 3118693)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
picnixz pushed a commit that referenced this issue Apr 4, 2025
gh-130655: Add tests for `gettext.find()` (GH-130691)

(cherry picked from commit 3118693)

Co-authored-by: Stan Ulbrych <89152624+StanFromIreland@users.noreply.github.com>
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
picnixz pushed a commit that referenced this issue Apr 4, 2025
…sed by `gettext` (GH-131909) (#132077)

gh-130655: Add a test for bad magic numbers in `.mo` files parsed by `gettext` (GH-131909)
(cherry picked from commit 16a6270)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
picnixz pushed a commit that referenced this issue Apr 4, 2025
…sed by `gettext` (GH-131909) (#132078)

gh-130655: Add a test for bad magic numbers in `.mo` files parsed by `gettext` (GH-131909)
(cherry picked from commit 16a6270)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
picnixz pushed a commit that referenced this issue Apr 4, 2025
…-131911) (#132079)

gh-130655: Add a test for corrupt `.mo` files in `gettext` (GH-131911)
(cherry picked from commit a126cef)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
picnixz pushed a commit that referenced this issue Apr 4, 2025
…-131911) (#132080)

gh-130655: Add a test for corrupt `.mo` files in `gettext` (GH-131911)
(cherry picked from commit a126cef)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
@StanFromIreland
Copy link
Contributor

Coverage is now at 85%!

@StanFromIreland
Copy link
Contributor

StanFromIreland commented Apr 12, 2025

The test file should be split into a data file and a test file IMO, any thoughts on this? See POC #132442

@tomasr8
Copy link
Member Author

tomasr8 commented Apr 12, 2025

Coverage is now at 85%!

Soon to be 86% 😆 I have a test for big-endian MO files lying around somewhere.

seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
seehwan pushed a commit to seehwan/cpython that referenced this issue Apr 16, 2025
@StanFromIreland
Copy link
Contributor

This needs to be removed from the docs project

miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 1, 2025
…nGH-132469)

(cherry picked from commit 474f296)

Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
serhiy-storchaka pushed a commit that referenced this issue May 1, 2025
…32469) (GH-133248)

(cherry picked from commit 474f296)

Co-authored-by: Tomas R <tomas.roun8@gmail.com>
@picnixz picnixz marked this as a duplicate of #134593 May 23, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
tests Tests in the Lib/test dir triaged The issue has been accepted as valid by a triager.
Projects
Status: No status
Status: Todo
Development

No branches or pull requests

4 participants