comparison test/test_dates.py @ 2217:98d3bf8ffb19

store Intervals as two columns (and other fixes
author Richard Jones <richard@users.sourceforge.net>
date Sun, 18 Apr 2004 05:31:03 +0000
parents bcc65c5b86e6
children eb4e7b8d52a2 770f9fa94c6a
comparison
equal deleted inserted replaced
2216:759ed26e24dd 2217:98d3bf8ffb19
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.31 2003-12-04 23:06:53 richard Exp $ 18 # $Id: test_dates.py,v 1.32 2004-04-18 05:31:03 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
263 def testIntervalAdd(self): 263 def testIntervalAdd(self):
264 ae = self.assertEqual 264 ae = self.assertEqual
265 ae(str(Interval('1y') + Interval('1y')), '+ 2y') 265 ae(str(Interval('1y') + Interval('1y')), '+ 2y')
266 ae(str(Interval('1y') + Interval('1m')), '+ 1y 1m') 266 ae(str(Interval('1y') + Interval('1m')), '+ 1y 1m')
267 ae(str(Interval('1y') + Interval('2:40')), '+ 1y 2:40') 267 ae(str(Interval('1y') + Interval('2:40')), '+ 1y 2:40')
268 ae(str(Interval('1y') + Interval('- 1y')), '') 268 ae(str(Interval('1y') + Interval('- 1y')), '00:00')
269 ae(str(Interval('- 1y') + Interval('1y')), '') 269 ae(str(Interval('- 1y') + Interval('1y')), '00:00')
270 ae(str(Interval('- 1y') + Interval('- 1y')), '- 2y') 270 ae(str(Interval('- 1y') + Interval('- 1y')), '- 2y')
271 ae(str(Interval('1y') + Interval('- 1m')), '+ 11m') 271 ae(str(Interval('1y') + Interval('- 1m')), '+ 11m')
272 ae(str(Interval('1:00') + Interval('1:00')), '+ 2:00') 272 ae(str(Interval('1:00') + Interval('1:00')), '+ 2:00')
273 ae(str(Interval('0:50') + Interval('0:50')), '+ 1:40') 273 ae(str(Interval('0:50') + Interval('0:50')), '+ 1:40')
274 ae(str(Interval('1:50') + Interval('- 1:50')), '') 274 ae(str(Interval('1:50') + Interval('- 1:50')), '00:00')
275 ae(str(Interval('- 1:50') + Interval('1:50')), '') 275 ae(str(Interval('- 1:50') + Interval('1:50')), '00:00')
276 ae(str(Interval('- 1:50') + Interval('- 1:50')), '- 3:40') 276 ae(str(Interval('- 1:50') + Interval('- 1:50')), '- 3:40')
277 ae(str(Interval('1:59:59') + Interval('00:00:01')), '+ 2:00') 277 ae(str(Interval('1:59:59') + Interval('00:00:01')), '+ 2:00')
278 ae(str(Interval('2:00') + Interval('- 00:00:01')), '+ 1:59:59') 278 ae(str(Interval('2:00') + Interval('- 00:00:01')), '+ 1:59:59')
279 279
280 def testIntervalSub(self): 280 def testIntervalSub(self):
281 ae = self.assertEqual 281 ae = self.assertEqual
282 ae(str(Interval('1y') - Interval('- 1y')), '+ 2y') 282 ae(str(Interval('1y') - Interval('- 1y')), '+ 2y')
283 ae(str(Interval('1y') - Interval('- 1m')), '+ 1y 1m') 283 ae(str(Interval('1y') - Interval('- 1m')), '+ 1y 1m')
284 ae(str(Interval('1y') - Interval('- 2:40')), '+ 1y 2:40') 284 ae(str(Interval('1y') - Interval('- 2:40')), '+ 1y 2:40')
285 ae(str(Interval('1y') - Interval('1y')), '') 285 ae(str(Interval('1y') - Interval('1y')), '00:00')
286 ae(str(Interval('1y') - Interval('1m')), '+ 11m') 286 ae(str(Interval('1y') - Interval('1m')), '+ 11m')
287 ae(str(Interval('1:00') - Interval('- 1:00')), '+ 2:00') 287 ae(str(Interval('1:00') - Interval('- 1:00')), '+ 2:00')
288 ae(str(Interval('0:50') - Interval('- 0:50')), '+ 1:40') 288 ae(str(Interval('0:50') - Interval('- 0:50')), '+ 1:40')
289 ae(str(Interval('1:50') - Interval('1:50')), '') 289 ae(str(Interval('1:50') - Interval('1:50')), '00:00')
290 ae(str(Interval('1:59:59') - Interval('- 00:00:01')), '+ 2:00') 290 ae(str(Interval('1:59:59') - Interval('- 00:00:01')), '+ 2:00')
291 ae(str(Interval('2:00') - Interval('00:00:01')), '+ 1:59:59') 291 ae(str(Interval('2:00') - Interval('00:00:01')), '+ 1:59:59')
292 292
293 def testOverflow(self): 293 def testOverflow(self):
294 ae = self.assertEqual 294 ae = self.assertEqual

Roundup Issue Tracker: http://roundup-tracker.org/