-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (20 loc) · 800 Bytes
/
test.py
File metadata and controls
32 lines (20 loc) · 800 Bytes
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
import pytest
from .hellstriangle import Triangle, TriangleException
def tests_empty_triangle():
assert Triangle([]).max_sum == 0
def tests_triagle_with_solo_number():
triangle = [[1337, ]]
assert Triangle(triangle).max_sum == 1337
def tests_simple_triangle():
triangle = [[0], [1, 2], [3, 4, 5]]
assert Triangle(triangle).max_sum == 7
def tests_challenges_example():
triangle = [[6], [3, 5], [9, 7, 1], [4, 6, 8, 4]]
assert Triangle(triangle).max_sum == 26
def tests_triangle_with_not_obvious_path():
triangle = [[1], [2, 3], [4, 5, 6], [93, 8, 9, 10]]
assert Triangle(triangle).max_sum == 100
def tests_triangle_with_invalid_structure():
triangle = [[1], [2, 3, 2], ]
with pytest.raises(TriangleException):
Triangle(triangle).max_sum