[Python-checkins] python/dist/src/Lib/test test_strptime.py,1.8,1.8.2.1
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Sun, 05 Jan 2003 15:06:59 -0800
Update of /cvsroot/python/python/dist/src/Lib/test
In directory sc8-pr-cvs1:/tmp/cvs-serv9632
Modified Files:
Tag: r23a1-branch
test_strptime.py
Log Message:
Patch #662053 by Brett Cannon: make strftime work on Mac OS 9.
Index: test_strptime.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/test/test_strptime.py,v
retrieving revision 1.8
retrieving revision 1.8.2.1
diff -C2 -d -r1.8 -r1.8.2.1
*** test_strptime.py 26 Dec 2002 16:19:52 -0000 1.8
--- test_strptime.py 5 Jan 2003 23:06:55 -0000 1.8.2.1
***************
*** 125,128 ****
--- 125,136 ----
self.assertRaises(TypeError, _strptime.LocaleTime, timezone=range(3))
+ def test_unknowntimezone(self):
+ # Handle timezone set to ('','') properly.
+ # Fixes bug #661354
+ locale_time = _strptime.LocaleTime(timezone=('',''))
+ self.failUnless("%Z" not in locale_time.LC_date,
+ "when timezone == ('',''), string.replace('','%Z') is "
+ "occuring")
+
class TimeRETests(unittest.TestCase):
"""Tests for TimeRE."""
***************
*** 181,190 ****
for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S',
'U','w','W','x','X','y','Y','Z','%'):
! compiled = self.time_re.compile("%%%s"% directive)
! found = compiled.match(time.strftime("%%%s" % directive))
self.failUnless(found, "Matching failed on '%s' using '%s' regex" %
! (time.strftime("%%%s" % directive),
compiled.pattern))
class StrptimeTests(unittest.TestCase):
"""Tests for _strptime.strptime."""
--- 189,205 ----
for directive in ('a','A','b','B','c','d','H','I','j','m','M','p','S',
'U','w','W','x','X','y','Y','Z','%'):
! compiled = self.time_re.compile("%" + directive)
! found = compiled.match(time.strftime("%" + directive))
self.failUnless(found, "Matching failed on '%s' using '%s' regex" %
! (time.strftime("%" + directive),
compiled.pattern))
+ def test_blankpattern(self):
+ # Make sure when tuple or something has no values no regex is generated.
+ # Fixes bug #661354
+ test_locale = _strptime.LocaleTime(timezone=('',''))
+ self.failUnless(_strptime.TimeRE(test_locale).pattern("%Z") == '',
+ "with timezone == ('',''), TimeRE().pattern('%Z') != ''")
+
class StrptimeTests(unittest.TestCase):
"""Tests for _strptime.strptime."""
***************
*** 263,267 ****
# When gmtime() is used with %Z, entire result of strftime() is empty.
# Check for equal timezone names deals with bad locale info when this
! # occurs; first found in FreeBSD 4.4 -current
time_tuple = time.localtime()
strf_output = time.strftime("%Z") #UTC does not have a timezone
--- 278,282 ----
# When gmtime() is used with %Z, entire result of strftime() is empty.
# Check for equal timezone names deals with bad locale info when this
! # occurs; first found in FreeBSD 4.4.
time_tuple = time.localtime()
strf_output = time.strftime("%Z") #UTC does not have a timezone
***************
*** 385,389 ****
def test_all_julian_days(self):
eq = self.assertEqual
- # XXX: should 0 be accepted?
for i in range(1, 367):
# use 2004, since it is a leap year, we have 366 days
--- 400,403 ----