summaryrefslogtreecommitdiff
path: root/gen_tests.py
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2005-05-10 20:58:18 +0000
committerArch Librarian <arch@canonical.com>2005-05-10 20:58:18 +0000
commit27f32d47b54627115b03cb1ff0fcaade9d7b06eb (patch)
treee27c276731ee7cfd5a27e53d60cfc49345db9037 /gen_tests.py
parent41e2fa30ede57d21fcd4ad81962e3a4db623295f (diff)
downloadpytz-27f32d47b54627115b03cb1ff0fcaade9d7b06eb.tar.gz
All localtime -> UTC tests now pass
Author: zenzen Date: 2004-07-24 18:05:54 GMT All localtime -> UTC tests now pass
Diffstat (limited to 'gen_tests.py')
-rw-r--r--gen_tests.py24
1 files changed, 5 insertions, 19 deletions
diff --git a/gen_tests.py b/gen_tests.py
index ce363a0..3c5236d 100644
--- a/gen_tests.py
+++ b/gen_tests.py
@@ -1,11 +1,11 @@
#!/usr/bin/env python
# -*- coding: ascii -*-
'''
-$Id: gen_tests.py,v 1.12 2004/07/23 23:24:44 zenzen Exp $
+$Id: gen_tests.py,v 1.13 2004/07/24 18:05:54 zenzen Exp $
'''
-__rcs_id__ = '$Id: gen_tests.py,v 1.12 2004/07/23 23:24:44 zenzen Exp $'
-__version__ = '$Revision: 1.12 $'[11:-2]
+__rcs_id__ = '$Id: gen_tests.py,v 1.13 2004/07/24 18:05:54 zenzen Exp $'
+__version__ = '$Revision: 1.13 $'[11:-2]
import os, os.path, popen2, re, sys
from gen_tzinfo import allzones
@@ -53,8 +53,6 @@ from datetime import tzinfo, timedelta, datetime
prev_is_dst = False
for idx in range(0, len(lines)):
line = lines[idx]
- #if '2002' not in line:
- # continue
m = re.match(
'^([^\s]+)\s+(.+\sUTC) \s+=\s+ (.+)\s([^\s]+) \s+isdst=(0|1)$',
line, re.X
@@ -79,15 +77,10 @@ from datetime import tzinfo, timedelta, datetime
# Urgh - utcoffset() and dst() have to be rounded to the nearest
# minute, so we need to break our tests to match this limitation
- real_offset = utc_dt - local_dt
+ real_offset = local_dt - utc_dt
secs = real_offset.seconds + real_offset.days*86400
fake_offset = timedelta(seconds=int((secs+30)/60)*60)
- if prev_dt is not None and prev_dt.second == 59:
- utc_dt = utc_dt + fake_offset - real_offset
- elif utc_dt.second in (0,59):
- local_dt = local_dt - fake_offset + real_offset
- else:
- utc_dt = utc_dt + fake_offset - real_offset
+ local_dt = utc_dt + fake_offset
# If the naive time on the previous line is greater than on this
# line, and we arn't seeing an end-of-dst transition, then
@@ -102,13 +95,6 @@ from datetime import tzinfo, timedelta, datetime
prev_is_dst = is_dst
prev_dt = local_dt
- # datetime resolution of 1 minute means the dst transition
- # might now be off by 30 seconds.
- # Make 'instant before' tests '30 seconds before' to cope :-(
- if utc_dt.second == 59 or local_dt.second == 59:
- utc_dt = utc_dt - timedelta(seconds=30)
- local_dt = local_dt - timedelta(seconds=30)
-
local_string = '%s %s' % (
local_dt.strftime('%a %b %d %H:%M:%S %Y'), tzname
)