Mercurial > p > roundup > code
diff test/test_dates.py @ 1537:0e36c9b23aa6
more lenient date input and addition Interval input support [SF#677764]
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Wed, 19 Mar 2003 05:18:11 +0000 |
| parents | 26f29449c494 |
| children | 4d55f90d4af1 |
line wrap: on
line diff
--- a/test/test_dates.py Wed Mar 19 03:33:55 2003 +0000 +++ b/test/test_dates.py Wed Mar 19 05:18:11 2003 +0000 @@ -15,7 +15,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: test_dates.py,v 1.21 2003-03-19 03:25:30 richard Exp $ +# $Id: test_dates.py,v 1.22 2003-03-19 05:18:11 richard Exp $ import unittest, time @@ -35,6 +35,8 @@ ae = self.assertEqual date = Date("2000-04-17") ae(str(date), '2000-04-17.00:00:00') + date = Date("2000/04/17") + ae(str(date), '2000-04-17.00:00:00') date = Date("2000-4-7") ae(str(date), '2000-04-07.00:00:00') date = Date("2000-4-17") @@ -44,6 +46,8 @@ ae(str(date), '%s-01-25.00:00:00'%y) date = Date("2000-04-17.03:45") ae(str(date), '2000-04-17.03:45:00') + date = Date("2000/04/17.03:45") + ae(str(date), '2000-04-17.03:45:00') date = Date("08-13.22:13") ae(str(date), '%s-08-13.22:13:00'%y) date = Date("11-07.09:32:43") @@ -162,6 +166,15 @@ ae(str(Interval(' 14:00 ')), '+ 14:00') ae(str(Interval(' 0:04:33 ')), '+ 0:04:33') + def testIntervalInitDate(self): + ae = self.assertEqual + now = Date('.') + now.hour = now.minute = now.second = 0 + then = now + Interval('2d') + ae(str(Interval(str(then))), '+ 2d') + then = now - Interval('2d') + ae(str(Interval(str(then))), '- 2d') + def testIntervalAdd(self): ae = self.assertEqual ae(str(Interval('1y') + Interval('1y')), '+ 2y')
