Mercurial > p > roundup > code
comparison test/test_dates.py @ 1535:26f29449c494
fixed detection of bad date specs [SF#691439]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 19 Mar 2003 03:25:30 +0000 |
| parents | c101d2ff5a20 |
| children | 0e36c9b23aa6 |
comparison
equal
deleted
inserted
replaced
| 1534:f0208e139234 | 1535:26f29449c494 |
|---|---|
| 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" | 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" |
| 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, | 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
| 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 17 # | 17 # |
| 18 # $Id: test_dates.py,v 1.20 2003-03-10 00:22:21 richard Exp $ | 18 # $Id: test_dates.py,v 1.21 2003-03-19 03:25:30 richard Exp $ |
| 19 | 19 |
| 20 import unittest, time | 20 import unittest, time |
| 21 | 21 |
| 22 from roundup.date import Date, Interval, Range, fixTimeOverflow | 22 from roundup.date import Date, Interval, Range, fixTimeOverflow |
| 23 | 23 |
| 51 date = Date("14:25") | 51 date = Date("14:25") |
| 52 ae(str(date), '%s-%02d-%02d.14:25:00'%(y, m, d)) | 52 ae(str(date), '%s-%02d-%02d.14:25:00'%(y, m, d)) |
| 53 date = Date("8:47:11") | 53 date = Date("8:47:11") |
| 54 ae(str(date), '%s-%02d-%02d.08:47:11'%(y, m, d)) | 54 ae(str(date), '%s-%02d-%02d.08:47:11'%(y, m, d)) |
| 55 | 55 |
| 56 def testDateError(self): | |
| 57 self.assertRaises(ValueError, Date, "12") | |
| 58 | |
| 56 def testOffset(self): | 59 def testOffset(self): |
| 57 ae = self.assertEqual | 60 ae = self.assertEqual |
| 58 date = Date("2000-04-17", -5) | 61 date = Date("2000-04-17", -5) |
| 59 ae(str(date), '2000-04-17.05:00:00') | 62 ae(str(date), '2000-04-17.05:00:00') |
| 60 date = Date("01-25", -5) | 63 date = Date("01-25", -5) |
