gh-69714: Make `calendar` module fully tested by bxsx · Pull Request #93655 · python/cpython
and others added 11 commits
….Locale{Text|HTML}Calendar`
There are 3 paths to use `locale` argument in
`calendar.Locale{Text|HTML}Calendar.__init__(..., locale=None)`:
(1) `locale=None` -- denotes the "default locale"[1]
(2) `locale=""` -- denotes the native environment
(3) `locale=other_valid_locale` -- denotes a custom locale
So far case (2) is covered and case (1) is in 78935da (same branch).
This commit adds a remaining case (3).
[1] In the current implementation, this translates into the following
approach:
GET current locale
IF current locale == "C" THEN
SET current locale TO ""
GET current locale
ENDIF
This condition cannot be true. `_locale.setlocale()` from the C module raises `locale.Error` instead of returning `None` for `different_locale.__enter__` (where `self.oldlocale` is set).
This patch has already been applied to `main` branch (via pythongh-93468), but with wrong copyright. After merging this commit to `main`, git `Author` metadata will be updated to the original author.
…verage)" This reverts commit a96786c.
…()`. This method temporarily changes the current locale to the given locale, so `_locale.setlocale()` may raise `local.Error`.
bxsx
marked this pull request as draft
These tests are now part of `test_illegal_arguments`. This reverts commit 238c527.
bxsx
marked this pull request as ready for review
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