mirror of
https://github.com/python/cpython.git
synced 2025-10-21 22:22:48 +00:00
gh-53203: Improve tests for strptime() (GH-125090)
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.
This commit is contained in:
parent
7c4b6a68f2
commit
19984fe024
10 changed files with 198 additions and 83 deletions
|
@ -2,7 +2,6 @@ from test import support
|
|||
from test.support import warnings_helper
|
||||
import decimal
|
||||
import enum
|
||||
import locale
|
||||
import math
|
||||
import platform
|
||||
import sys
|
||||
|
@ -600,17 +599,8 @@ class TimeTestCase(unittest.TestCase):
|
|||
|
||||
|
||||
class TestLocale(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oldloc = locale.setlocale(locale.LC_ALL)
|
||||
|
||||
def tearDown(self):
|
||||
locale.setlocale(locale.LC_ALL, self.oldloc)
|
||||
|
||||
@support.run_with_locale('LC_ALL', 'fr_FR', '')
|
||||
def test_bug_3061(self):
|
||||
try:
|
||||
tmp = locale.setlocale(locale.LC_ALL, "fr_FR")
|
||||
except locale.Error:
|
||||
self.skipTest('could not set locale.LC_ALL to fr_FR')
|
||||
# This should not cause an exception
|
||||
time.strftime("%B", (2009,2,1,0,0,0,0,0,0))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue