From 6d0cb35c95630da1a3d351439a484c1d16275355 Mon Sep 17 00:00:00 2001 From: anthonybaxter Date: Mon, 3 Nov 2003 10:33:23 +0000 Subject: [PATCH] more tests for date difference. Completely broken code right now. git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1955 57a73879-2fb5-44c3-a270-3262357dd7e2 --- test/test_dates.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/test/test_dates.py b/test/test_dates.py index a43a7b1..c521c28 100644 --- a/test/test_dates.py +++ b/test/test_dates.py @@ -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.27 2003-11-03 10:23:06 anthonybaxter Exp $ +# $Id: test_dates.py,v 1.28 2003-11-03 10:33:23 anthonybaxter Exp $ import unittest, time @@ -238,9 +238,22 @@ class DateTestCase(unittest.TestCase): self.assertEqual(str(then), '2004-02-02.00:00:00') def testDateSubtract(self): + # These are thoroughly broken right now. + i = Date('2003-03-15.00:00:00') - Date('2003-03-10.00:00:00') + self.assertEqual(i, Interval('5d')) + i = Date('2003-02-01.00:00:00') - Date('2003-03-01.00:00:00') + self.assertEqual(i, Interval('-28d')) + i = Date('2003-03-01.00:00:00') - Date('2003-02-01.00:00:00') + self.assertEqual(i, Interval('28d')) + i = Date('2003-03-03.00:00:00') - Date('2002-02-01.00:00:00') + self.assertEqual(i, Interval('30d')) + i = Date('2003-03-03.00:00:00') - Date('2002-04-01.00:00:00') + self.assertEqual(i, Interval('-29d')) + i = Date('2003-03-01.00:00:00') - Date('2002-02-01.00:00:00') + self.assertEqual(i, Interval('1m')) # force the transition over a year boundary i = Date('2003-01-01.00:00:00') - Date('2002-01-01.00:00:00') - self.assertEqual(str(i).strip(), '1y') + self.assertEqual(i, Interval('365d')) def testIntervalAdd(self): ae = self.assertEqual -- 2.30.2