Skip to content

Commit df93876

Browse files
author
Anthony Baxter
committed
more tests for date difference. Completely broken code right now.
1 parent 967b9e0 commit df93876

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

test/test_dates.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1616
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1717
#
18-
# $Id: test_dates.py,v 1.27 2003-11-03 10:23:06 anthonybaxter Exp $
18+
# $Id: test_dates.py,v 1.28 2003-11-03 10:33:23 anthonybaxter Exp $
1919

2020
import unittest, time
2121

@@ -238,9 +238,22 @@ def testIntervalSubtractYearBoundary(self):
238238
self.assertEqual(str(then), '2004-02-02.00:00:00')
239239

240240
def testDateSubtract(self):
241+
# These are thoroughly broken right now.
242+
i = Date('2003-03-15.00:00:00') - Date('2003-03-10.00:00:00')
243+
self.assertEqual(i, Interval('5d'))
244+
i = Date('2003-02-01.00:00:00') - Date('2003-03-01.00:00:00')
245+
self.assertEqual(i, Interval('-28d'))
246+
i = Date('2003-03-01.00:00:00') - Date('2003-02-01.00:00:00')
247+
self.assertEqual(i, Interval('28d'))
248+
i = Date('2003-03-03.00:00:00') - Date('2002-02-01.00:00:00')
249+
self.assertEqual(i, Interval('30d'))
250+
i = Date('2003-03-03.00:00:00') - Date('2002-04-01.00:00:00')
251+
self.assertEqual(i, Interval('-29d'))
252+
i = Date('2003-03-01.00:00:00') - Date('2002-02-01.00:00:00')
253+
self.assertEqual(i, Interval('1m'))
241254
# force the transition over a year boundary
242255
i = Date('2003-01-01.00:00:00') - Date('2002-01-01.00:00:00')
243-
self.assertEqual(str(i).strip(), '1y')
256+
self.assertEqual(i, Interval('365d'))
244257

245258
def testIntervalAdd(self):
246259
ae = self.assertEqual

0 commit comments

Comments
 (0)