Issue #5562: Use wcsftime for time.strftime where available.

This commit is contained in:
Martin v. Löwis 2009-05-30 06:13:40 +00:00
parent 3ad05763a6
commit 1b01ccd76a
4 changed files with 65 additions and 12 deletions

View file

@ -1,7 +1,7 @@
from test import support
import time
import unittest
import locale
class TimeTestCase(unittest.TestCase):
@ -223,9 +223,24 @@ class TimeTestCase(unittest.TestCase):
t1 = time.mktime(lt1)
self.assert_(0 <= (t1-t0) < 0.2)
def test_main():
support.run_unittest(TimeTestCase)
class TestLocale(unittest.TestCase):
def setUp(self):
self.oldloc = locale.setlocale(locale.LC_ALL)
def tearDown(self):
locale.setlocale(locale.LC_ALL, self.oldloc)
def test_bug_5562(self):
try:
tmp = locale.setlocale(locale.LC_ALL, "fr_FR")
except locale.Error:
# skip this test
return
# This should not cause an exception
time.strftime("%B", (2009,2,1,0,0,0,0,0,0))
def test_main():
support.run_unittest(TimeTestCase, TestLocale)
if __name__ == "__main__":
test_main()