-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_routes_fetcher.py
88 lines (73 loc) · 2.35 KB
/
test_routes_fetcher.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
from routes_fetcher import get_ordered_route_segments
def test_get_ordered_route_segments_with_empty_source_list():
source_route_segments = []
ordered_route_segments = get_ordered_route_segments(source_route_segments)
assert ordered_route_segments == []
def test_get_ordered_route_segments_with_ordered_source_list_with_one_trajectory():
source_route_segments = [
[[1, 1], [0, 0]],
[[2, 3], [1, 1]],
[[4, 4], [2, 3]],
[[3, 1], [4, 4]],
[[0, 0], [3, 1]],
]
ordered_route_segments = get_ordered_route_segments(source_route_segments)
assert ordered_route_segments == [
[[1, 1], [0, 0]],
[[2, 3], [1, 1]],
[[4, 4], [2, 3]],
[[3, 1], [4, 4]],
[[0, 0], [3, 1]],
]
def test_get_ordered_route_segments_with_unordered_source_list_with_one_trajectory():
source_route_segments = [
[[1, 1], [0, 0]],
[[4, 4], [2, 3]],
[[0, 0], [3, 1]],
[[3, 1], [4, 4]],
[[2, 3], [1, 1]],
]
ordered_route_segments = get_ordered_route_segments(source_route_segments)
assert ordered_route_segments == [
[[1, 1], [0, 0]],
[[2, 3], [1, 1]],
[[4, 4], [2, 3]],
[[3, 1], [4, 4]],
[[0, 0], [3, 1]],
]
def test_get_ordered_route_segments_with_ordered_source_list_with_two_trajectories():
source_route_segments = [
[[1, 1], [0, 0]],
[[2, 3], [1, 1]],
[[4, 4], [2, 3]],
[[4, 2], [6, 3]],
[[7, 1], [4, 2]],
[[2, 0], [7, 1]],
]
ordered_route_segments = get_ordered_route_segments(source_route_segments)
assert ordered_route_segments == [
[[1, 1], [0, 0]],
[[2, 3], [1, 1]],
[[4, 4], [2, 3]],
[[4, 2], [6, 3]],
[[7, 1], [4, 2]],
[[2, 0], [7, 1]],
]
def test_get_ordered_route_segments_with_unordered_source_list_with_two_trajectories():
source_route_segments = [
[[1, 1], [0, 0]],
[[4, 2], [6, 3]],
[[2, 3], [1, 1]],
[[2, 0], [7, 1]],
[[7, 1], [4, 2]],
[[4, 4], [2, 3]],
]
ordered_route_segments = get_ordered_route_segments(source_route_segments)
assert ordered_route_segments == [
[[1, 1], [0, 0]],
[[2, 3], [1, 1]],
[[4, 4], [2, 3]],
[[4, 2], [6, 3]],
[[7, 1], [4, 2]],
[[2, 0], [7, 1]],
]