test_the_end_of_other.Tests.test_Basics()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 3
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
import unittest
2
3
from the_end_of_other import checkio
4
5
6
class Tests(unittest.TestCase):
7
    TESTS = {
8
        "Basics": [
9
            {
10
                "input": ["hello", "lo", "he"],
11
                "answer": True,
12
                "explanation": ["hel", "lo"],
13
            },
14
            {
15
                "input": ["hello", "la", "hellow", "cow"],
16
                "answer": False,
17
                "explanation": None,
18
            },
19
            {
20
                "input": ["walk", "duckwalk"],
21
                "answer": True,
22
                "explanation": ["duck", "walk"],
23
            },
24
            {"input": ["one"], "answer": False, "explanation": None},
25
            {"input": ["helicopter", "li", "he"], "answer": False, "explanation": None},
26
        ],
27
        "Extra": [
28
            {
29
                "input": ["a", "the", "wall", "world", "nine"],
30
                "answer": False,
31
                "explanation": None,
32
            },
33
            {
34
                "input": ['longest', 'aa', 'a'],
35
                "answer": True,
36
                "explanation": ["a", "a"],
37
            },
38
            {
39
                "input": [
40
                    'jsakhfakljsdfhsakjdfhljkasdhfkasdjhfjklasdhfkasdhfalksjdhejkyrieucbciuwaeiuwhewkqjiorfuvnfjhbkehraa',
41
                    'aarhekbhjfnvufroijqkwehwuieawuicbcueirykjehdjsklafhdsakfhdsalkjfhjdsakfhdsakjlhfdjkashfdsjlkafhkasj',
42
                ],
43
                "answer": False,
44
                "explanation": None,
45
            },
46
            {
47
                "input": ["abc", "cba", "ba", "a", "c"],
48
                "answer": True,
49
                "explanation": ["cba", "ba"],
50
            },
51
            {
52
                "input": ["chupacabra", "megachupacabra", "gigachupacabra"],
53
                "answer": True,
54
                "explanation": ["mega", "chupacabra"],
55
            },
56
            {
57
                "input": ["giga", "mega", "woltz", "kilo"],
58
                "answer": False,
59
                "explanation": None,
60
            },
61
            {
62
                "input": [
63
                    "one",
64
                    "two",
65
                    "three",
66
                    "four",
67
                    "five",
68
                    "six",
69
                    "seven",
70
                    "eight",
71
                    "nine",
72
                    "ten",
73
                ],
74
                "answer": False,
75
                "explanation": None,
76
            },
77
            {
78
                "input": [
79
                    "one",
80
                    "two",
81
                    "three",
82
                    "four",
83
                    "five",
84
                    "six",
85
                    "seven",
86
                    "eight",
87
                    "nine",
88
                    "ten",
89
                    "pacsix",
90
                ],
91
                "answer": True,
92
                "explanation": ["pac", "six"],
93
            },
94
            {
95
                "input": [
96
                    'a',
97
                    'b',
98
                    'c',
99
                    'd',
100
                    'e',
101
                    'f',
102
                    'g',
103
                    'h',
104
                    'i',
105
                    'j',
106
                    'k',
107
                    'l',
108
                    'm',
109
                    'n',
110
                    'o',
111
                    'p',
112
                    'q',
113
                    'r',
114
                    's',
115
                    't',
116
                    'u',
117
                    'v',
118
                    'w',
119
                    'x',
120
                    'y',
121
                    'z',
122
                ],
123
                "answer": False,
124
                "explanation": None,
125
            },
126
            {
127
                "input": ["check", "io", "checkio"],
128
                "answer": True,
129
                "explanation": ["check", "io"],
130
            },
131
        ],
132
    }
133
134
    def test_Basics(self):
135
        for i in self.TESTS['Basics']:
136
            assert checkio(i['input']) == i['answer']
137
138
    def test_Extra(self):
139
        for i in self.TESTS['Extra']:
140
            assert checkio(i['input']) == i['answer']
141
142
143
if __name__ == "__main__":  # pragma: no cover
144
    unittest.main()
145