comparison test/test_dates.py @ 6380:d76291836523

Fix issue2551128 - Impossible to validate a user with unknown timezone Raise KeyError when an unrecognized timezones is passed to pytz. (patch Cedric Krier, test John Rouillard)
author John Rouillard <rouilj@ieee.org>
date Sun, 18 Apr 2021 17:39:44 -0400
parents db429c75caec
children 0f0cee081990
comparison
equal deleted inserted replaced
6379:843a88670707 6380:d76291836523
493 ae(str(date), '2006-04-04.10:00:00') 493 ae(str(date), '2006-04-04.10:00:00')
494 date = Date('2006-01-01.12:00:00') 494 date = Date('2006-01-01.12:00:00')
495 date = Date(date, tz) 495 date = Date(date, tz)
496 ae(str(date), '2006-01-01.11:00:00') 496 ae(str(date), '2006-01-01.11:00:00')
497 497
498 def testUnrecognizedTimezone(self):
499 '''Unrecognize timezone should raise key error'''
500
501 # unrecognized timezone
502 tz = 'Zoot'
503
504 with self.assertRaises(KeyError) as cm:
505 date = Date('2006-04-04.12:00:00', tz)
506
507 self.assertEqual(cm.exception.args, ('Zoot',))
498 508
499 class RangeTestCase(unittest.TestCase): 509 class RangeTestCase(unittest.TestCase):
500 510
501 def testRange(self): 511 def testRange(self):
502 ae = self.assertEqual 512 ae = self.assertEqual

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