comparison test/test_dates.py @ 3211:e330f751828e maint-0.8

test invalid tuple handling
author Alexander Smishlajev <a1s@users.sourceforge.net>
date Fri, 25 Feb 2005 17:24:53 +0000
parents 22f16d0646ce
children c75dd71a7963
comparison
equal deleted inserted replaced
3209:368dbeba7bc0 3211:e330f751828e
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.35 2004-11-29 14:34:10 a1s Exp $ 18 # $Id: test_dates.py,v 1.35.2.1 2005-02-25 17:24:53 a1s 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
60 ae(str(Date('2003')), '2003-01-01.00:00:00') 60 ae(str(Date('2003')), '2003-01-01.00:00:00')
61 ae(str(Date('2004-06')), '2004-06-01.00:00:00') 61 ae(str(Date('2004-06')), '2004-06-01.00:00:00')
62 62
63 def testDateError(self): 63 def testDateError(self):
64 self.assertRaises(ValueError, Date, "12") 64 self.assertRaises(ValueError, Date, "12")
65 # Date cannot handle dates before UNIX epoch
66 self.assertRaises(ValueError, Date, (1, 1, 1, 0, 0, 0.0, 0, 1, -1))
65 67
66 def testOffset(self): 68 def testOffset(self):
67 ae = self.assertEqual 69 ae = self.assertEqual
68 date = Date("2000-04-17", -5) 70 date = Date("2000-04-17", -5)
69 ae(str(date), '2000-04-17.05:00:00') 71 ae(str(date), '2000-04-17.05:00:00')
388 390
389 if __name__ == '__main__': 391 if __name__ == '__main__':
390 runner = unittest.TextTestRunner() 392 runner = unittest.TextTestRunner()
391 unittest.main(testRunner=runner) 393 unittest.main(testRunner=runner)
392 394
393 # vim: set filetype=python ts=4 sw=4 et si : 395 # vim: set filetype=python sts=4 sw=4 et si :

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