Added test for a bug fixed in issue #665194.

This commit is contained in:
Alexander Belopolsky 2012-08-22 22:06:37 -04:00
parent 097a1208bc
commit 1f924d21d3
1 changed files with 12 additions and 0 deletions

View File

@ -3,6 +3,7 @@ from email import utils
import test.support
import time
import unittest
import sys
class DateTimeTests(unittest.TestCase):
@ -119,6 +120,17 @@ class LocaltimeTests(unittest.TestCase):
t2 = utils.localtime(t0.replace(tzinfo=None))
self.assertEqual(t1, t2)
# XXX: Need a more robust test for Olson's tzdata
@unittest.skipIf(sys.platform.startswith('win'),
"Windows does not use Olson's TZ database")
@test.support.run_with_tz('Europe/Kiev')
def test_variable_tzname(self):
t0 = datetime.datetime(1984, 1, 1, tzinfo=datetime.timezone.utc)
t1 = utils.localtime(t0)
self.assertEqual(t1.tzname(), 'MSK')
t0 = datetime.datetime(1994, 1, 1, tzinfo=datetime.timezone.utc)
t1 = utils.localtime(t0)
self.assertEqual(t1.tzname(), 'EET')
if __name__ == '__main__':
unittest.main()