Mercurial > p > roundup > code
diff test/test_dates.py @ 1885:deba54ed724f
Date arithmetic fixes.
Date +/- Interval passes all tests again, after fixing a couple of the
tests to actually reflect the calendar used on my planet rather than
where-ever Richard was when he wrote the test <wink>
The basic problem was that when going backwards, the code was adding
the days of the current month, rather than the previous month.
There's still a bug in the testDateSubtract that I'll fix next.
Bugfix candidate (probably)
| author | Anthony Baxter <anthonybaxter@users.sourceforge.net> |
|---|---|
| date | Mon, 03 Nov 2003 10:23:06 +0000 |
| parents | dc55a195722d |
| children | e3cff1bb1b86 |
line wrap: on
line diff
--- a/test/test_dates.py Sun Nov 02 09:27:50 2003 +0000 +++ b/test/test_dates.py Mon Nov 03 10:23:06 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.26 2003-11-02 09:27:50 richard Exp $ +# $Id: test_dates.py,v 1.27 2003-11-03 10:23:06 anthonybaxter Exp $ import unittest, time @@ -205,7 +205,7 @@ self.assertEqual(str(then), '2004-02-28.00:00:00') now = Date('2003-03-01.00:00:00') then = now - Interval('1d') - self.assertEqual(str(then), '2003-02-08.00:00:00') + self.assertEqual(str(then), '2003-02-28.00:00:00') now = Date('2003-03-01.00:00:00') then = now - Interval('59d') self.assertEqual(str(then), '2003-01-01.00:00:00') @@ -219,10 +219,10 @@ then = now + Interval('2d') self.assertEqual(str(then), '2004-01-01.00:00:00') now = Date('2003-01-01.00:00:00') - then = now + Interval('364d') + then = now + Interval('365d') self.assertEqual(str(then), '2004-01-01.00:00:00') now = Date('2004-01-01.00:00:00') - then = now + Interval('365d') + then = now + Interval('366d') self.assertEqual(str(then), '2005-01-01.00:00:00') def testIntervalSubtractYearBoundary(self):
