diff options
| author | Brett Cannon <bcannon@gmail.com> | 2003-08-11 07:24:05 (GMT) |
|---|---|---|
| committer | Brett Cannon <bcannon@gmail.com> | 2003-08-11 07:24:05 (GMT) |
| commit | 5187a3bcdb565c30fc998078a3fcc3293f963ffd (patch) | |
| tree | 75036c3efdc7548a408652a7d1a815581ca9be17 /Lib/test/test_strptime.py | |
| parent | 3081d59f920229b26293c7a3ee3f1a9da0da53e9 (diff) | |
| download | cpython-5187a3bcdb565c30fc998078a3fcc3293f963ffd.zip cpython-5187a3bcdb565c30fc998078a3fcc3293f963ffd.tar.gz cpython-5187a3bcdb565c30fc998078a3fcc3293f963ffd.tar.bz2 | |
Fix handling of bad locale setup where time.tzname[0] == time.tzname[1] and
time.daylight is true. Add an explicit test for this situation.
Fixed some wording in docstrings.
Diffstat (limited to 'Lib/test/test_strptime.py')
| -rw-r--r-- | Lib/test/test_strptime.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_strptime.py b/Lib/test/test_strptime.py index fef5d90..4ce37f8 100644 --- a/Lib/test/test_strptime.py +++ b/Lib/test/test_strptime.py @@ -5,6 +5,7 @@ import time import locale import re import sets +import sys from test import test_support import _strptime @@ -258,6 +259,9 @@ class StrptimeTests(unittest.TestCase): self.failUnlessEqual(strp_output.tm_isdst, 0) strp_output = _strptime.strptime("GMT", "%Z") self.failUnlessEqual(strp_output.tm_isdst, 0) + if sys.platform == "mac": + # Timezones don't really work on MacOS9 + return time_tuple = time.localtime() strf_output = time.strftime("%Z") #UTC does not have a timezone strp_output = _strptime.strptime(strf_output, "%Z") @@ -271,6 +275,22 @@ class StrptimeTests(unittest.TestCase): "LocaleTime().timezone has duplicate values and " "time.daylight but timezone value not set to -1") + def test_bad_timezone(self): + # Explicitly test possibility of bad timezone; + # when time.tzname[0] == time.tzname[1] and time.daylight + if sys.platform == "mac": + return #MacOS9 has severely broken timezone support. + try: + original_tzname = time.tzname + original_daylight = time.daylight + time.tzname = ("PDT", "PDT") + time.daylight = 1 + tz_value = _strptime.strptime("PDT", "%Z")[8] + self.failUnlessEqual(tz_value, -1) + finally: + time.tzname = original_tzname + time.daylight = original_daylight + def test_date_time(self): # Test %c directive for position in range(6): |
