Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 35.2k
gh-131146: Fix month names in a genitive case in calendar module#131147
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
Uh oh!
There was an error while loading. Please reload this page.
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
b7a55ee
gh-131146: Fix month names in a genitive case in calendar module.
plashchynski fb1c5ee
Make `alt_month_name` and `alt_month_abbr` public in the `calendar` m…
plashchynski ab52586
Add NEWS entries.
plashchynski 6177415
Fix py:func references in NEWS.d
plashchynski a11ecfb
Refinement changes:
plashchynski 46c7513
Apply suggested style changes
plashchynski 9badac0
Rename `calendar.alt_month_name` to `calendar.standalone_month_name`,…
plashchynski fce8599
Refine news message wording for better clarity
plashchynski 7a175d5
Style guide compliance:
plashchynski 36bb456
Fix roles of and in the NEWS.d entry.
plashchynski 5feb1dc
Fix grammar and wording
plashchynski 1ecc613
Rewording
plashchynski 1f92067
Revert unrelated formatting changes
plashchynski 4b946bf
Remove the examples as they are pointless in the English locale
plashchynski 3137d37
Remove the comment, as the previous comment covers it
plashchynski 2ddd6f6
Merge NEWS entries as they both are for the same issue
plashchynski 0862fac
Simpler wording
plashchynski 833682c
Merge branch 'main' into fix_calendar_genitive_case
plashchynski 9d1582c
Add a test for standalone month names and abbrs in the pl_PL locale
plashchynski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -8,6 +8,7 @@ | ||
| import io | ||
| import locale | ||
| import os | ||
| import platform | ||
| import sys | ||
| import time | ||
| @@ -546,7 +547,8 @@ def test_days(self): | ||
| self.assertEqual(value[::-1], list(reversed(value))) | ||
| def test_months(self): | ||
| for attr in "month_name", "month_abbr": | ||
| for attr in ("month_name", "month_abbr", "standalone_month_name", | ||
| "standalone_month_abbr"): | ||
| value = getattr(calendar, attr) | ||
| self.assertEqual(len(value), 13) | ||
| self.assertEqual(len(value[:]), 13) | ||
| @@ -556,6 +558,38 @@ def test_months(self): | ||
| # verify it "acts like a sequence" in two forms of iteration | ||
| self.assertEqual(value[::-1], list(reversed(value))) | ||
| @support.run_with_locale('LC_ALL', 'pl_PL') | ||
| @unittest.skipUnless(sys.platform == 'darwin' or platform.libc_ver()[0] == 'glibc', | ||
| "Guaranteed to work with glibc and macOS") | ||
| def test_standalone_month_name_and_abbr_pl_locale(self): | ||
| expected_standalone_month_names = [ | ||
| "", "styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", | ||
| "lipiec", "sierpień", "wrzesień", "październik", "listopad", | ||
| "grudzień" | ||
| ] | ||
| expected_standalone_month_abbr = [ | ||
| "", "sty", "lut", "mar", "kwi", "maj", "cze", | ||
| "lip", "sie", "wrz", "paź", "lis", "gru" | ||
| ] | ||
| self.assertEqual( | ||
| list(calendar.standalone_month_name), | ||
| expected_standalone_month_names | ||
| ) | ||
| self.assertEqual( | ||
| list(calendar.standalone_month_abbr), | ||
| expected_standalone_month_abbr | ||
| ) | ||
| def test_standalone_month_name_and_abbr_C_locale(self): | ||
| # Ensure that the standalone month names and abbreviations are | ||
| # equal to the regular month names and abbreviations for | ||
| # the "C" locale. | ||
| with calendar.different_locale("C"): | ||
plashchynski marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| self.assertListEqual(list(calendar.month_name), | ||
| list(calendar.standalone_month_name)) | ||
| self.assertListEqual(list(calendar.month_abbr), | ||
| list(calendar.standalone_month_abbr)) | ||
| def test_locale_text_calendar(self): | ||
| try: | ||
| cal = calendar.LocaleTextCalendar(locale='') | ||
6 changes: 6 additions & 0 deletions
6 Misc/NEWS.d/next/Library/2025-03-17-21-21-06.gh-issue-131146.A5Obgv.rst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Fix :class:`calendar.TextCalendar`, :class:`calendar.HTMLCalendar`, | ||
| and the :mod:`calendar` CLI to display month names in the nominative | ||
| case by adding :data:`calendar.standalone_month_name` and | ||
| :data:`calendar.standalone_month_abbr`, which provide month names and | ||
| abbreviations in the grammatical form used when a month name stands by | ||
| itself, if the locale supports it. |
Oops, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.