forked from gmunkhbaatarmn/codeforces-mn
/
parse_test.py
36 lines (28 loc) · 932 Bytes
/
parse_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import nose
import parse as _
from nose.tools import eq_ as eq
def test_contest():
eq(_.contest(433), {
"name": "Codeforces Round #248 (Div. 2)",
"problems": [
("A", "Kitahara Haruki's Gift"),
("B", "Kuriyama Mirai's Stones"),
("C", "Ryouko's Memory Note"),
("D", "Nanami's Digital Board"),
("E", "Tachibana Kanade's Tofu"),
],
})
eq(_.contest(1000), None)
eq(_.contest(0), None)
def test_problemset():
eq(_.problemset(20)[-1], ["1A", "Theatre Square"])
def test_problem():
p = _.problem("10-A")
eq(p["input"], "standard input")
eq(p["output"], "standard output")
eq(p["memory"], "256 megabytes")
eq(p["time"], "1 second")
eq(p["tests"][0], ("1 3 2 1 5 10\n0 10", "30"))
eq(p["tests"][1], ("2 8 4 2 5 10\n20 30\n50 100", "570"))
if __name__ == "__main__":
nose.main(defaultTest=__file__)