Skip to content

Commit

Permalink
backport second test time improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
hannosch committed Aug 10, 2012
1 parent 68f95f2 commit b73c26d
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 10 deletions.
57 changes: 57 additions & 0 deletions src/DateTime/tests/julian_testdata.txt
@@ -0,0 +1,57 @@
1970-01-01 (1970, 1, 4)
1970-01-02 (1970, 1, 5)
1970-01-30 (1970, 5, 5)
1970-01-31 (1970, 5, 6)
1970-02-01 (1970, 5, 7)
1970-02-02 (1970, 6, 1)
1970-02-28 (1970, 9, 6)
1970-03-01 (1970, 9, 7)
1970-03-30 (1970, 14, 1)
1970-03-31 (1970, 14, 2)
1970-04-01 (1970, 14, 3)
1970-09-30 (1970, 40, 3)
1970-10-01 (1970, 40, 4)
1970-10-02 (1970, 40, 5)
1970-10-03 (1970, 40, 6)
1970-10-04 (1970, 40, 7)
1970-10-05 (1970, 41, 1)
1971-01-02 (1970, 53, 6)
1971-01-03 (1970, 53, 7)
1971-01-04 (1971, 1, 1)
1971-01-05 (1971, 1, 2)
1971-12-31 (1971, 52, 5)
1972-01-01 (1971, 52, 6)
1972-01-02 (1971, 52, 7)
1972-01-03 (1972, 1, 1)
1972-01-04 (1972, 1, 2)
1972-12-30 (1972, 52, 6)
1972-12-31 (1972, 52, 7)
1973-01-01 (1973, 1, 1)
1973-01-02 (1973, 1, 2)
1973-12-29 (1973, 52, 6)
1973-12-30 (1973, 52, 7)
1973-12-31 (1974, 1, 1)
1974-01-01 (1974, 1, 2)
1998-12-30 (1998, 53, 3)
1998-12-31 (1998, 53, 4)
1999-01-01 (1998, 53, 5)
1999-01-02 (1998, 53, 6)
1999-01-03 (1998, 53, 7)
1999-01-04 (1999, 1, 1)
1999-01-05 (1999, 1, 2)
1999-12-30 (1999, 52, 4)
1999-12-31 (1999, 52, 5)
2000-01-01 (1999, 52, 6)
2000-01-02 (1999, 52, 7)
2000-01-03 (2000, 1, 1)
2000-01-04 (2000, 1, 2)
2000-01-05 (2000, 1, 3)
2000-01-06 (2000, 1, 4)
2000-01-07 (2000, 1, 5)
2000-01-08 (2000, 1, 6)
2000-01-09 (2000, 1, 7)
2000-01-10 (2000, 2, 1)
2019-12-28 (2019, 52, 6)
2019-12-29 (2019, 52, 7)
2019-12-30 (2020, 1, 1)
2019-12-31 (2020, 1, 2)
Binary file removed src/DateTime/tests/julian_testdata.txt.gz
Binary file not shown.
14 changes: 4 additions & 10 deletions src/DateTime/tests/testDateTime.py
Expand Up @@ -437,18 +437,12 @@ def testISO8601(self):

def testJulianWeek(self):
# Check JulianDayWeek function
try:
import gzip
except ImportError:
print "Warning: testJulianWeek disabled: module gzip not found"
return 0

fn = os.path.join(DATADIR, 'julian_testdata.txt.gz')
lines = gzip.GzipFile(fn).readlines()

fn = os.path.join(DATADIR, 'julian_testdata.txt')
with open(fn, 'r') as fd:
lines = fd.readlines()
for line in lines:
d = DateTime(line[:10])
result_from_mx=tuple(map(int, line[12:-2].split(',')))
result_from_mx = tuple(map(int, line[12:-2].split(',')))
self.assertEqual(result_from_mx[1], d.week())

def testCopyConstructor(self):
Expand Down

0 comments on commit b73c26d

Please sign in to comment.