We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d58444c commit 97c1bfbCopy full SHA for 97c1bfb
Lib/test/test_time.py
@@ -187,6 +187,24 @@ def test_epoch(self):
187
# Only test the date and time, ignore other gmtime() members
188
self.assertEqual(tuple(epoch)[:6], (1970, 1, 1, 0, 0, 0), epoch)
189
190
+ def test_gmtime(self):
191
+ # expected format:
192
+ # (tm_year, tm_mon, tm_mday,
193
+ # tm_hour, tm_min, tm_sec,
194
+ # tm_wday, tm_yday)
195
+ for t, expected in (
196
+ (-13262400, (1969, 7, 31, 12, 0, 0, 3, 212)),
197
+ (-6177600, (1969, 10, 21, 12, 0, 0, 1, 294)),
198
+ # non-leap years (pre epoch)
199
+ (-2203891200, (1900, 3, 1, 0, 0, 0, 3, 60)),
200
+ (-5359564800, (1800, 3, 1, 0, 0, 0, 3, 60)),
201
+ # leap years (pre epoch)
202
+ (-2077660800, (1904, 3, 1, 0, 0, 0, 3, 61)),
203
+ ):
204
+ with self.subTest(t=t, expected=expected):
205
+ res = time.gmtime(t)
206
+ self.assertEqual(tuple(res)[:8], expected, res)
207
+
208
def test_strftime(self):
209
tt = time.gmtime(self.t)
210
for directive in ('a', 'A', 'b', 'B', 'c', 'd', 'H', 'I',
0 commit comments