[Checkins] SVN: DateTime/trunk/src/DateTime/tests/ Avoid some brute-force tests using every day in the range of 1970 to 2020

Hanno Schlichting hannosch at hannosch.eu
Sun May 8 06:35:49 EDT 2011


Log message for revision 121575:
  Avoid some brute-force tests using every day in the range of 1970 to 2020
  

Changed:
  A   DateTime/trunk/src/DateTime/tests/julian_testdata.txt
  D   DateTime/trunk/src/DateTime/tests/julian_testdata.txt.gz
  U   DateTime/trunk/src/DateTime/tests/testDateTime.py

-=-
Added: DateTime/trunk/src/DateTime/tests/julian_testdata.txt
===================================================================
--- DateTime/trunk/src/DateTime/tests/julian_testdata.txt	                        (rev 0)
+++ DateTime/trunk/src/DateTime/tests/julian_testdata.txt	2011-05-08 10:35:49 UTC (rev 121575)
@@ -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)


Property changes on: DateTime/trunk/src/DateTime/tests/julian_testdata.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Deleted: DateTime/trunk/src/DateTime/tests/julian_testdata.txt.gz
===================================================================
(Binary files differ)

Modified: DateTime/trunk/src/DateTime/tests/testDateTime.py
===================================================================
--- DateTime/trunk/src/DateTime/tests/testDateTime.py	2011-05-07 16:18:24 UTC (rev 121574)
+++ DateTime/trunk/src/DateTime/tests/testDateTime.py	2011-05-08 10:35:49 UTC (rev 121575)
@@ -402,15 +402,9 @@
 
     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(',')))
@@ -469,12 +463,12 @@
         self.assertEqual(dts[5], "%+03d%02d" % divmod( (-offset/60), 60) )
 
     def testInternationalDateformat(self):
-        for year in range(1990, 2020):
+        for year in (1990, 2020):
             for month in range (1, 13):
                 for day in range(1, 32):
                     try:
                         d_us = DateTime("%d/%d/%d" % (year,month,day))
-                    except:
+                    except Exception:
                         continue
 
                     d_int = DateTime("%d.%d.%d" % (day,month,year),



More information about the checkins mailing list