forked from idlv75/dragons-and-princesses
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdragons_princesses_tests.py
36 lines (29 loc) · 1.22 KB
/
dragons_princesses_tests.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 unittest
from dragons_princesses import parse_and_print_results
from dragons_princesses import read_parse_yaml_data
class MainTestClass(unittest.TestCase):
def test_parse_and_print_results_good(self):
dragons_array = [('12', 3), ('1', 5)]
dragons_ammount_to_kill = 2
res = parse_and_print_results(dragons_array, dragons_ammount_to_kill)
self.assertEqual(res, True)
def test_parse_and_print_results_bad(self):
dragons_array = [('12', 3), ('1', 5)]
dragons_ammount_to_kill = 3
res = parse_and_print_results(dragons_array, dragons_ammount_to_kill)
self.assertEqual(res, False)
def test_read_parse_yaml_data(self):
with self.assertRaises(Exception):
read_parse_yaml_data("broken_path")
def test_first_scenario(self):
queue = find_path("input1.yaml")
self.assertEqual(len(queue), 2)
cells_list = [3, 5]
dragons_cells = [obj.cell_number for obj in queue]
self.assertListEqual(cells_list, dragons_cells)
#
# def test_second_scenario(self):
# queue = find_path("input1.yaml")
# self.assertEqual(sum(int(x.coins) for x in queue), 13)
if __name__ == "__main__":
unittest.main()