[Python-checkins] python/dist/src/Lib/test test_strptime.py,
1.19.4.2, 1.19.4.3
bcannon at users.sourceforge.net
bcannon at users.sourceforge.net
Mon Aug 11 01:19:08 EDT 2003
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv397/Lib/test
Modified Files:
Tag: release23-maint
test_strptime.py
Log Message:
Fix bug where handling issue of time.tzname[0] == time.tzname[1] and
time.daylight were all true. Add an explicit test for this issue.
Closes bug #783952 .
Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.19.4.2
retrieving revision 1.19.4.3
diff -C2 -d -r1.19.4.2 -r1.19.4.3
*** test_strptime.py 6 Aug 2003 21:17:09 -0000 1.19.4.2
--- test_strptime.py 11 Aug 2003 07:19:06 -0000 1.19.4.3
***************
*** 320,323 ****
--- 320,346 ----
"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
+ # Need to make sure that timezone is not calculated since that
+ # calls time.tzset and overrides temporary changes to time .
+ _strptime._locale_cache = _strptime.TimeRE(_strptime.LocaleTime(
+ timezone=("PDT", "PDT")))
+ _strptime._regex_cache.clear()
+ tz_value = _strptime.strptime("PDT", "%Z")[8]
+ self.failUnlessEqual(tz_value, -1)
+ finally:
+ time.tzname = original_tzname
+ time.daylight = original_daylight
+ _strptime._locale_cache = _strptime.TimeRE()
+ _strptime._regex_cache.clear()
+
def test_date_time(self):
# Test %c directive
More information about the Python-checkins
mailing list