diff options
author | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-06-14 17:32:03 +0000 |
---|---|---|
committer | Alexander Belopolsky <alexander.belopolsky@gmail.com> | 2010-06-14 17:32:03 +0000 |
commit | 4a19b20f25314313d7c792a83ac59ac1f52974fe (patch) | |
tree | db66ce8cd7951ad688cc6a148cf3598d3351d0c1 /Lib/test/test_calendar.py | |
parent | ea1228eff704a92d73f3d8321652bedfd6248ff5 (diff) | |
download | cpython-4a19b20f25314313d7c792a83ac59ac1f52974fe.tar.gz |
Issue 6280: Tests and simpler implementation for calendar.timegm
Diffstat (limited to 'Lib/test/test_calendar.py')
-rw-r--r-- | Lib/test/test_calendar.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/Lib/test/test_calendar.py b/Lib/test/test_calendar.py index e8b2ca5482..b7ce4750e0 100644 --- a/Lib/test/test_calendar.py +++ b/Lib/test/test_calendar.py @@ -2,7 +2,7 @@ import calendar import unittest from test import support - +import time result_2004_text = """ 2004 @@ -381,13 +381,21 @@ class SundayTestCase(MonthCalendarTestCase): # A 31-day december starting on friday (2+7+7+7+7+1 days) self.check_weeks(1995, 12, (2, 7, 7, 7, 7, 1)) +class TimegmTestCase(unittest.TestCase): + TIMESTAMPS = [0, 10, 100, 1000, 10000, 100000, 1000000, + 1234567890, 1262304000, 1275785153,] + def test_timegm(self): + for secs in self.TIMESTAMPS: + tuple = time.gmtime(secs) + self.assertEqual(secs, calendar.timegm(tuple)) def test_main(): support.run_unittest( OutputTestCase, CalendarTestCase, MondayTestCase, - SundayTestCase + SundayTestCase, + TimegmTestCase, ) |