|
1
|
|
|
import unittest |
|
2
|
|
|
|
|
3
|
|
|
from seven_segment import possible_numbers, seven_segment |
|
4
|
|
|
|
|
5
|
|
|
|
|
6
|
|
|
def test_possible_numbers(): |
|
7
|
|
|
first_digit = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] |
|
8
|
|
|
second_digit = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] |
|
9
|
|
|
assert possible_numbers({'B', 'C', 'b', 'c'}, {'A'}, first_digit) == [1, 7] |
|
10
|
|
|
assert possible_numbers({'B', 'C', 'b', 'c'}, {'A'}, second_digit) == [1] |
|
11
|
|
|
|
|
12
|
|
|
assert possible_numbers( |
|
13
|
|
|
{'B', 'C', 'a', 'f', 'g', 'c', 'd'}, {'A', 'G', 'D', 'e'}, first_digit |
|
14
|
|
|
) == [1, 3, 7] |
|
15
|
|
|
assert possible_numbers( |
|
16
|
|
|
{'B', 'C', 'a', 'f', 'g', 'c', 'd'}, {'A', 'G', 'D', 'e'}, second_digit |
|
17
|
|
|
) == [5, 6] |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
# class Tests(unittest.TestCase): |
|
21
|
|
|
# TESTS = { |
|
22
|
|
|
# "Basics": [ |
|
23
|
|
|
# { |
|
24
|
|
|
# "input": [['B', 'C', 'b', 'c'], |
|
25
|
|
|
# ['A']], |
|
26
|
|
|
# "answer": 2, |
|
27
|
|
|
# }, |
|
28
|
|
|
# { |
|
29
|
|
|
# "input": [['B', 'C', 'a', 'f', 'g', 'c', 'd'], |
|
30
|
|
|
# ['A', 'G', 'D', 'e']], |
|
31
|
|
|
# "answer": 6, |
|
32
|
|
|
# }, |
|
33
|
|
|
# { |
|
34
|
|
|
# "input": [['A', 'B', 'C', 'D', 'E', 'F', 'a', 'b', 'c', 'd', 'e', 'f'], |
|
35
|
|
|
# ['G', 'g']], |
|
36
|
|
|
# "answer": 4, |
|
37
|
|
|
# }, |
|
38
|
|
|
# { |
|
39
|
|
|
# "input": [['B', 'C', 'a', 'f', 'g', 'c', 'd'], |
|
40
|
|
|
# ['A', 'G', 'D', 'F', 'b', 'e']], |
|
41
|
|
|
# "answer": 20, |
|
42
|
|
|
# }, |
|
43
|
|
|
# { |
|
44
|
|
|
# "input": [['A', 'B', 'C', 'b', 'c', 'f', 'g'], |
|
45
|
|
|
# ['G', 'd']], |
|
46
|
|
|
# "answer": 1, |
|
47
|
|
|
# }, |
|
48
|
|
|
# { |
|
49
|
|
|
# "input": [[], |
|
50
|
|
|
# ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'a', 'b', 'c', 'd', 'e', 'f', 'g']], |
|
51
|
|
|
# "answer": 100, |
|
52
|
|
|
# }, |
|
53
|
|
|
# ], |
|
54
|
|
|
# # "Randoms": make_test(10), |
|
55
|
|
|
# } |
|
56
|
|
|
|
|
57
|
|
|
# def test_Basics(self): |
|
58
|
|
|
# for i in self.TESTS['Basics']: |
|
59
|
|
|
# assert seven_segment(*i['input']) == i['answer'], i['input'] |
|
60
|
|
|
|
|
61
|
|
|
# # def test_Extra(self): |
|
62
|
|
|
# # for i in self.TESTS['Extra']: |
|
63
|
|
|
# # assert seven_segment(i['input']) == i['answer'], i['input'] |
|
64
|
|
|
|
|
65
|
|
|
|
|
66
|
|
|
# if __name__ == "__main__": # pragma: no cover |
|
67
|
|
|
# unittest.main() |
|
68
|
|
|
|