Mercurial > p > roundup > code
comparison test/test_dates.py @ 1941:bcc65c5b86e6
fixed date arithmetic to not allow day-of-month == 0 [SF#853306]
fixed date arithmetic to limit hours-per-day to 24, not 60
| author | Richard Jones <richard@users.sourceforge.net> |
|---|---|
| date | Thu, 04 Dec 2003 23:06:53 +0000 |
| parents | 71056b09f2bf |
| children | 98d3bf8ffb19 |
comparison
equal
deleted
inserted
replaced
| 1939:1303c208419d | 1941:bcc65c5b86e6 |
|---|---|
| 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.30 2003-11-19 22:53:14 jlgijsbers Exp $ | 18 # $Id: test_dates.py,v 1.31 2003-12-04 23:06:53 richard Exp $ |
| 19 from __future__ import nested_scopes | 19 from __future__ import nested_scopes |
| 20 | 20 |
| 21 import unittest, time | 21 import unittest, time |
| 22 | 22 |
| 23 from roundup.date import Date, Interval, Range, fixTimeOverflow | 23 from roundup.date import Date, Interval, Range, fixTimeOverflow |
| 120 date = Date('2001-02-28.22:58:59') + Interval('00:00:3661') | 120 date = Date('2001-02-28.22:58:59') + Interval('00:00:3661') |
| 121 ae(str(date), '2001-03-01.00:00:00') | 121 ae(str(date), '2001-03-01.00:00:00') |
| 122 | 122 |
| 123 def testOffsetSub(self): | 123 def testOffsetSub(self): |
| 124 ae = self.assertEqual | 124 ae = self.assertEqual |
| 125 date = Date('2000-12-01') - Interval('- 1d') | |
| 126 | |
| 125 date = Date('2000-01-01') - Interval('- 2y 2m') | 127 date = Date('2000-01-01') - Interval('- 2y 2m') |
| 126 ae(str(date), '2002-03-01.00:00:00') | 128 ae(str(date), '2002-03-01.00:00:00') |
| 127 date = Date('2000-01-01') - Interval('2m') | 129 date = Date('2000-01-01') - Interval('2m') |
| 128 ae(str(date), '1999-11-01.00:00:00') | 130 ae(str(date), '1999-11-01.00:00:00') |
| 129 | 131 |
