◐ Shell
clean mode source ↗

gh-69714: Make `calendar` module fully tested by bxsx · Pull Request #93655 · python/cpython

and others added 11 commits

June 6, 2022 02:29
….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.

AA-Turner

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
…verage)"

This reverts commit a96786c.
…()`.

This method temporarily changes the current locale to the given locale,
so `_locale.setlocale()` may raise `local.Error`.
… test coverage)""

This reverts commit 40e0da3.
So it brings back commit a96786c.

@bxsx

@bxsx bxsx marked this pull request as draft

June 10, 2022 02:05

hugovk

No need to process the function.
This also helps in supporting CLI testing.
These tests are now part of `test_illegal_arguments`.
This reverts commit 238c527.

@bxsx bxsx marked this pull request as ready for review

June 11, 2022 19:06

AA-Turner

@iritkatriel

StanFromIreland