comparison test/test_dates.py @ 861:68cef2bb929d

fixed the date module so that Date(". - 2d") works
author Richard Jones <richard@users.sourceforge.net>
date Sun, 14 Jul 2002 06:05:50 +0000
parents cfa460943d4d
children 9b910e8d987d
comparison
equal deleted inserted replaced
860:2df32a73eb45 861:68cef2bb929d
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.11 2002-02-21 23:34:52 richard Exp $ 18 # $Id: test_dates.py,v 1.12 2002-07-14 06:05:50 richard Exp $
19 19
20 import unittest, time 20 import unittest, time
21 21
22 from roundup.date import Date, Interval 22 from roundup.date import Date, Interval
23 23
72 ae(str(date), '%s-%02d-%02d.13:47:11'%(y, m, d)) 72 ae(str(date), '%s-%02d-%02d.13:47:11'%(y, m, d))
73 73
74 # now check calculations 74 # now check calculations
75 date = Date('2000-01-01') + Interval('- 2y 2m') 75 date = Date('2000-01-01') + Interval('- 2y 2m')
76 ae(str(date), '1997-11-01.00:00:00') 76 ae(str(date), '1997-11-01.00:00:00')
77 date = Date('2000-01-01 - 2y 2m')
78 ae(str(date), '1997-11-01.00:00:00')
77 date = Date('2000-01-01') + Interval('2m') 79 date = Date('2000-01-01') + Interval('2m')
80 ae(str(date), '2000-03-01.00:00:00')
81 date = Date('2000-01-01 + 2m')
78 ae(str(date), '2000-03-01.00:00:00') 82 ae(str(date), '2000-03-01.00:00:00')
79 83
80 date = Date('2000-01-01') + Interval('60d') 84 date = Date('2000-01-01') + Interval('60d')
81 ae(str(date), '2000-03-01.00:00:00') 85 ae(str(date), '2000-03-01.00:00:00')
82 date = Date('2001-01-01') + Interval('60d') 86 date = Date('2001-01-01') + Interval('60d')
148 return unittest.makeSuite(DateTestCase, 'test') 152 return unittest.makeSuite(DateTestCase, 'test')
149 153
150 154
151 # 155 #
152 # $Log: not supported by cvs2svn $ 156 # $Log: not supported by cvs2svn $
157 # Revision 1.11 2002/02/21 23:34:52 richard
158 # Oops, there's 24 hours in a day, and subtraction of intervals now works
159 # properly.
160 #
153 # Revision 1.10 2002/02/21 23:11:45 richard 161 # Revision 1.10 2002/02/21 23:11:45 richard
154 # . fixed some problems in date calculations (calendar.py doesn't handle over- 162 # . fixed some problems in date calculations (calendar.py doesn't handle over-
155 # and under-flow). Also, hour/minute/second intervals may now be more than 163 # and under-flow). Also, hour/minute/second intervals may now be more than
156 # 99 each. 164 # 99 each.
157 # 165 #

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