diff options
author | Brett Cannon <bcannon@gmail.com> | 2003-07-24 06:27:17 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2003-07-24 06:27:17 (GMT) |
commit | 175ddb5b30f742d47f5567cea106934cc125138d (patch) | |
tree | 567d62b95bbcc548eeafb03eff8b04977a338569 /Lib/test | |
parent | 98741af1700eb20f353c61f89a3c24e3a05f5c6d (diff) | |
download | cpython-175ddb5b30f742d47f5567cea106934cc125138d.zip cpython-175ddb5b30f742d47f5567cea106934cc125138d.tar.gz cpython-175ddb5b30f742d47f5567cea106934cc125138d.tar.bz2 |
Remove caching of TimeRE (and thus LocaleTime) instance. Error was being
caught when executing test_strptime, test_logging, and test_time in that order
when the testing of "%c" occured. Suspect the cache was not being recreated
(the test passed when test_logging was forced to re-establish the locale).
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_strptime.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index 77319d9..9ac75e6 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -8,6 +8,11 @@ from test import test_support import _strptime +class getlang_Tests(unittest.TestCase): + """Test _getlang""" + def test_basic(self): + self.failUnlessEqual(_strptime._getlang(), locale.getlocale(locale.LC_TIME)) + class LocaleTime_Tests(unittest.TestCase): """Tests for _strptime.LocaleTime.""" @@ -89,11 +94,9 @@ class LocaleTime_Tests(unittest.TestCase): "empty strings") def test_lang(self): - # Make sure lang is set - self.failUnless(self.LT_ins.lang in (locale.getdefaultlocale()[0], - locale.getlocale(locale.LC_TIME)[0], - ''), - "Setting of lang failed") + # Make sure lang is set to what _getlang() returns + # Assuming locale has not changed between now and when self.LT_ins was created + self.failUnlessEqual(self.LT_ins.lang, _strptime._getlang()) def test_by_hand_input(self): # Test passed-in initialization value checks @@ -410,15 +413,15 @@ class CalculationTests(unittest.TestCase): self.failUnless(result.tm_wday == self.time_tuple.tm_wday, "Calculation of day of the week failed;" "%s != %s" % (result.tm_wday, self.time_tuple.tm_wday)) - def test_main(): test_support.run_unittest( + getlang_Tests, LocaleTime_Tests, TimeRETests, StrptimeTests, Strptime12AMPMTests, JulianTests, - CalculationTests + CalculationTests, ) |