comparison test/test_dates.py @ 3952:c68581212cf7

add some Range testing, all of which currently fails
author Richard Jones <richard@users.sourceforge.net>
date Thu, 20 Dec 2007 01:01:49 +0000
parents a5fb7698439d
children 78dc9b275aeb
comparison
equal deleted inserted replaced
3951:53b922e0d2b7 3952:c68581212cf7
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.41 2007-03-12 17:53:38 schlatterbeck Exp $ 18 # $Id: test_dates.py,v 1.42 2007-12-20 01:01:49 richard Exp $
19 from __future__ import nested_scopes 19 from __future__ import nested_scopes
20 20
21 import unittest 21 import unittest
22 import time 22 import time
23 import datetime 23 import datetime
464 ae(str(date), '2006-04-04.10:00:00') 464 ae(str(date), '2006-04-04.10:00:00')
465 date = Date('2006-01-01.12:00:00') 465 date = Date('2006-01-01.12:00:00')
466 date = Date(date, tz) 466 date = Date(date, tz)
467 ae(str(date), '2006-01-01.11:00:00') 467 ae(str(date), '2006-01-01.11:00:00')
468 468
469 class RangeTestCase(unittest.TestCase):
470 def testRange(self):
471 ae = self.assertEqual
472 r = Range('2006', Date)
473 ae(str(r.from_value), '2006-01-01.00:00:00')
474 ae(str(r.to_value), '2006-12-31.23:59:59')
475 # XXX this is probably in the calendar module
476 days = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)
477 for i in range(1, 13):
478 print i
479 r = Range('2006-%02d'%i, Date)
480 ae(str(r.from_value), '2006-%02d-01.00:00:00'%i)
481 ae(str(r.to_value), '2006-%02d-%02d.23:59:59'%(i, days[i-1]))
482
483
469 def test_suite(): 484 def test_suite():
470 suite = unittest.TestSuite() 485 suite = unittest.TestSuite()
471 suite.addTest(unittest.makeSuite(DateTestCase)) 486 suite.addTest(unittest.makeSuite(DateTestCase))
487 suite.addTest(unittest.makeSuite(RangeTestCase))
472 try: 488 try:
473 import pytz 489 import pytz
474 except ImportError: 490 except ImportError:
475 pass 491 pass
476 else: 492 else:

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