mirror of
https://github.com/python/cpython.git
synced 2025-08-03 16:39:00 +00:00
Issue #5562: Use wcsftime for time.strftime where available.
This commit is contained in:
parent
3ad05763a6
commit
1b01ccd76a
4 changed files with 65 additions and 12 deletions
|
@ -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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue