mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue 6280: Tests and simpler implementation for calendar.timegm
This commit is contained in:
parent
4e749a1113
commit
43ca710a44
2 changed files with 13 additions and 10 deletions
|
@ -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,
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue