Mercurial > p > roundup > code
diff 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 |
line wrap: on
line diff
--- a/test/test_dates.py Sat Apr 17 18:11:48 2021 -0400 +++ b/test/test_dates.py Sun Apr 18 17:39:44 2021 -0400 @@ -495,6 +495,16 @@ date = Date(date, tz) ae(str(date), '2006-01-01.11:00:00') + def testUnrecognizedTimezone(self): + '''Unrecognize timezone should raise key error''' + + # unrecognized timezone + tz = 'Zoot' + + with self.assertRaises(KeyError) as cm: + date = Date('2006-04-04.12:00:00', tz) + + self.assertEqual(cm.exception.args, ('Zoot',)) class RangeTestCase(unittest.TestCase):
