Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e703842

Browse files
committed
Tweaks to cope with strftime returning 0 without error for %Z
1 parent f07eaea commit e703842

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

Lib/test/test_strftime.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def strftest(now):
6969
nonstandard_expectations = (
7070
# These are standard but don't have predictable output
7171
('%c', fixasctime(time.asctime(now)), 'near-asctime() format'),
72-
('%Z', tz, 'time zone name'),
72+
('(%Z)', '(%s)' % tz, 'time zone name'),
7373

7474
# These are some platform specific extensions
7575
('%D', '%02d/%02d/%02d' % (now[1], now[2], (now[0]%100)), 'mm/dd/yy'),

Lib/test/test_time.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,11 @@
1616
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
1717
'j', 'm', 'M', 'p', 'S',
1818
'U', 'w', 'W', 'x', 'X', 'y', 'Y', 'Z', '%'):
19-
format = '%' + directive
20-
time.strftime(format, tt)
19+
format = ' %' + directive
20+
try:
21+
time.strftime(format, tt)
22+
except ValueError:
23+
print 'conversion specifier:', format, ' failed.'
2124

2225
time.timezone
2326
time.tzname

0 commit comments

Comments
 (0)