Skip to content
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

Increase test coverage of the python_format checker #1176

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tomasr8
Copy link
Member

@tomasr8 tomasr8 commented Jan 17, 2025

There a few bugs that I found in the python_format checker while working on the linter that I'd like to fix (e.g. one is that it does not validate msgstr[N] for N >= 2).

Though before I start fixing anything, I want to make sure we have the checker fully covered with tests as it would be pretty easy to accidentally introduce other bugs.

cc @akx

@@ -65,9 +65,6 @@ def _validate_format(format: str, alternative: str) -> None:
arguments are not interchangeable as `alternative` may contain less
placeholders if `format` uses named placeholders.

The behavior of this function is undefined if the string does not use
Copy link
Member Author

@tomasr8 tomasr8 Jan 17, 2025

Choose a reason for hiding this comment

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

I think this is wrong - python_format happily calls this method when format does not contain any format placeholders (for example when msgid contains them but msgid_plural does not, python_format will still call _validate_format(msgid_plural, msgstr)).

Copy link

codecov bot commented Jan 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.54%. Comparing base (98b9562) to head (7135ae9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1176      +/-   ##
==========================================
+ Coverage   91.37%   91.54%   +0.17%     
==========================================
  Files          27       27              
  Lines        4672     4674       +2     
==========================================
+ Hits         4269     4279      +10     
+ Misses        403      395       -8     
Flag Coverage Δ
macos-14-3.10 90.56% <100.00%> (+0.17%) ⬆️
macos-14-3.11 90.50% <100.00%> (+0.17%) ⬆️
macos-14-3.12 90.71% <100.00%> (+0.17%) ⬆️
macos-14-3.13 90.71% <100.00%> (+0.17%) ⬆️
macos-14-3.8 90.43% <100.00%> (+0.17%) ⬆️
macos-14-3.9 90.49% <100.00%> (+0.17%) ⬆️
macos-14-pypy3.10 90.56% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-3.10 90.58% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-3.11 90.52% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-3.12 90.73% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-3.13 90.73% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-3.8 90.45% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-3.9 90.51% <100.00%> (+0.17%) ⬆️
ubuntu-24.04-pypy3.10 90.58% <100.00%> (+0.17%) ⬆️
windows-2022-3.10 90.59% <100.00%> (+0.17%) ⬆️
windows-2022-3.11 90.53% <100.00%> (+0.17%) ⬆️
windows-2022-3.12 90.74% <100.00%> (+0.17%) ⬆️
windows-2022-3.13 90.74% <100.00%> (+0.17%) ⬆️
windows-2022-3.8 90.57% <100.00%> (+0.17%) ⬆️
windows-2022-3.9 90.52% <100.00%> (+0.17%) ⬆️
windows-2022-pypy3.10 90.59% <100.00%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tomasr8
Copy link
Member Author

tomasr8 commented Jan 17, 2025

+0.17% in overall coverage 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant