comparison test/test_dates.py @ 225:49748e59852a

fixed a 2.1-ism
author Richard Jones <richard@users.sourceforge.net>
date Mon, 13 Aug 2001 23:01:53 +0000
parents 18134bffab37
children 22e0edf7da6e c242455d9b46
comparison
equal deleted inserted replaced
224:ad2c98faec97 225:49748e59852a
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.6 2001-08-07 00:24:43 richard Exp $ 18 # $Id: test_dates.py,v 1.7 2001-08-13 23:01:53 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
34 def testDate(self): 34 def testDate(self):
35 ae = self.assertEqual 35 ae = self.assertEqual
36 date = Date("2000-04-17") 36 date = Date("2000-04-17")
37 ae(str(date), '2000-04-17.00:00:00') 37 ae(str(date), '2000-04-17.00:00:00')
38 date = Date("01-25") 38 date = Date("01-25")
39 y, m, d, x, x, x, x, x, x = time.gmtime() 39 y, m, d, x, x, x, x, x, x = time.gmtime(time.time())
40 ae(str(date), '%s-01-25.00:00:00'%y) 40 ae(str(date), '%s-01-25.00:00:00'%y)
41 date = Date("2000-04-17.03:45") 41 date = Date("2000-04-17.03:45")
42 ae(str(date), '2000-04-17.03:45:00') 42 ae(str(date), '2000-04-17.03:45:00')
43 date = Date("08-13.22:13") 43 date = Date("08-13.22:13")
44 ae(str(date), '%s-08-13.22:13:00'%y) 44 ae(str(date), '%s-08-13.22:13:00'%y)
52 def testOffset(self): 52 def testOffset(self):
53 ae = self.assertEqual 53 ae = self.assertEqual
54 date = Date("2000-04-17", -5) 54 date = Date("2000-04-17", -5)
55 ae(str(date), '2000-04-17.00:00:00') 55 ae(str(date), '2000-04-17.00:00:00')
56 date = Date("01-25", -5) 56 date = Date("01-25", -5)
57 y, m, d, x, x, x, x, x, x = time.gmtime() 57 y, m, d, x, x, x, x, x, x = time.gmtime(time.time())
58 ae(str(date), '%s-01-25.00:00:00'%y) 58 ae(str(date), '%s-01-25.00:00:00'%y)
59 date = Date("2000-04-17.03:45", -5) 59 date = Date("2000-04-17.03:45", -5)
60 ae(str(date), '2000-04-17.08:45:00') 60 ae(str(date), '2000-04-17.08:45:00')
61 date = Date("08-13.22:13", -5) 61 date = Date("08-13.22:13", -5)
62 ae(str(date), '%s-08-14.03:13:00'%y) 62 ae(str(date), '%s-08-14.03:13:00'%y)
81 return unittest.makeSuite(DateTestCase, 'test') 81 return unittest.makeSuite(DateTestCase, 'test')
82 82
83 83
84 # 84 #
85 # $Log: not supported by cvs2svn $ 85 # $Log: not supported by cvs2svn $
86 # Revision 1.6 2001/08/07 00:24:43 richard
87 # stupid typo
88 #
86 # Revision 1.5 2001/08/07 00:15:51 richard 89 # Revision 1.5 2001/08/07 00:15:51 richard
87 # Added the copyright/license notice to (nearly) all files at request of 90 # Added the copyright/license notice to (nearly) all files at request of
88 # Bizar Software. 91 # Bizar Software.
89 # 92 #
90 # Revision 1.4 2001/07/29 23:32:13 richard 93 # Revision 1.4 2001/07/29 23:32:13 richard

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