-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathim_thinking_of_a_number_test.py
56 lines (44 loc) · 1.54 KB
/
im_thinking_of_a_number_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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from unittest import TestCase
from im_thinking_of_a_number import ClueFormatter
class TestClueFormatter(TestCase):
def test_default_values(self):
clue_formatter = ClueFormatter([])
self.assertEqual(clue_formatter.less_than, 50001)
self.assertEqual(clue_formatter.greater_than, 0)
self.assertEqual(clue_formatter.divisible_by, [])
def test_can_read_clues(self):
clues = [
"less than 100",
"greater than 5",
"divisible by 7"
]
clue_formatter = ClueFormatter(clues)
self.assertEqual(clue_formatter.less_than, 100)
self.assertEqual(clue_formatter.greater_than, 5)
self.assertEqual(clue_formatter.divisible_by, [7])
def test_less_than(self):
clues = [
"less than 200",
"less than 100",
"less than 150",
]
clue_formatter = ClueFormatter(clues)
self.assertEqual(clue_formatter.less_than, 100)
def test_greater_than(self):
clues = [
"greater than 6",
"greater than 400",
"greater than 100",
"greater than 7"
]
clue_formatter = ClueFormatter(clues)
self.assertEqual(clue_formatter.greater_than, 400)
def test_divisible_by(self):
clues = [
"divisible by 1",
"divisible by 5",
"divisible by 3",
"divisible by 2"
]
clue_formatter = ClueFormatter(clues)
self.assertEqual(clue_formatter.divisible_by, [1, 5, 3, 2])