Skip to content

Commit 4cae9a3

Browse files
author
Paul Sokolovsky
committed
time: Add test_strftime.py.
Based on test patterns prepared by @sschwartzcpu.
1 parent eaf7228 commit 4cae9a3

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

time/test_strftime.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
from time import strftime
2+
3+
# These tuples were generated using localtime() and gmtime() in CPython.
4+
INPUT = (
5+
(2017, 1, 1, 23, 40, 39, 6, 222, 1),
6+
(2010, 2, 28, 9, 59, 60, 1, 111, 0),
7+
(2000, 3, 31, 1, 33, 0, 2, 44, 1),
8+
(2020, 4, 30, 21, 22, 59, 3, 234, 0),
9+
(1977, 5, 15, 23, 55, 1, 4, 123, 1),
10+
(1940, 6, 11, 9, 21, 33, 5, 55, 0),
11+
(1918, 7, 24, 6, 12, 44, 7, 71, 1),
12+
(1800, 8, 17, 0, 59, 55, 3, 89, 0),
13+
(2222, 9, 5, 1, 0, 4, 2, 255, 1),
14+
(2017, 10, 10, 9, 1, 5, 6, 200, 0),
15+
(2016, 11, 7, 18, 8, 16, 7, 100, 1),
16+
(2001, 12, 2, 12, 19, 27, 1, 33, 0),
17+
)
18+
19+
# These values were generated using strftime() in CPython.
20+
EXPECTED = (
21+
('20170101234039'),
22+
('20100228095960'),
23+
('20000331013300'),
24+
('20200430212259'),
25+
('19770515235501'),
26+
('19400611092133'),
27+
('19180724061244'),
28+
('18000817005955'),
29+
('22220905010004'),
30+
('20171010090105'),
31+
('20161107180816'),
32+
('20011202121927'),
33+
)
34+
35+
for i in range(len(INPUT)):
36+
assert strftime("%Y%m%d%H%M%S", INPUT[i]) == EXPECTED[i]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy