[3.12] gh-53203: Improve tests for strptime() (GH-125090) (GH-125093)

Run them with different locales and different date and time.

Add the @run_with_locales() decorator to run the test with multiple
locales.

Improve the run_with_locale() context manager/decorator -- it now
catches only expected exceptions and reports the test as skipped if no
appropriate locale is available.
(cherry picked from commit 19984fe024)
This commit is contained in:
Serhiy Storchaka 2024-10-08 12:47:37 +03:00 committed by GitHub
parent bc237ed9a8
commit 82257374b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 199 additions and 84 deletions

View file

@ -1676,7 +1676,7 @@ class UnicodeTest(string_tests.CommonTest,
self.assertIn('str', exc)
self.assertIn('tuple', exc)
@support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR')
@support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR', '')
def test_format_float(self):
# should not format with a comma, but always with C locale
self.assertEqual('1.0', '%.1f' % 1.0)