-
-
Notifications
You must be signed in to change notification settings - Fork 137
/
test_describe_graph_line.py
80 lines (74 loc) · 2.43 KB
/
test_describe_graph_line.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
from unittesting import DeferrableTestCase
from GitSavvy.tests.mockito import mock
from GitSavvy.tests.parameterized import parameterized as p
from GitSavvy.core.commands.log_graph import describe_graph_line
examples = [
(
"|",
{},
None
),
(
"● a3062b2 (HEAD -> optimize-graph-render, origin/optimize-graph-render) Abort .. | Thu 21:07, herr kaste",
{
"optimize-graph-render": mock({"is_local": True}),
"origin/optimize-graph-render": mock({"is_local": False})
},
{
"commit": "a3062b2",
"HEAD": "optimize-graph-render",
"branches": ["optimize-graph-render", "origin/optimize-graph-render"],
"local_branches": ["optimize-graph-render"]
}
),
(
"● a3062b2 (HEAD, origin/optimize-graph-render) Abort re.. | Thu 21:07, herr kaste",
{"origin/optimize-graph-render": mock({"is_local": False})},
{
"commit": "a3062b2",
"HEAD": "a3062b2",
"branches": ["origin/optimize-graph-render"]
}
),
(
# Unknown refs are in `branches` (sic!) but *not* under `local_branches`.
"● a3062b2 (HEAD -> optimize-graph-render, refs/bisect/bad) Abort .. | Thu 21:07, herr kaste",
{
"optimize-graph-render": mock({"is_local": True}),
},
{
"commit": "a3062b2",
"HEAD": "optimize-graph-render",
"branches": ["optimize-graph-render", "refs/bisect/bad"],
"local_branches": ["optimize-graph-render"]
}
),
(
"● ad6d88c (HEAD) Use view from the argument instead of on self | Thu 20:56, herr kaste",
{},
{
"commit": "ad6d88c",
"HEAD": "ad6d88c",
}
),
(
"● ad6d88c Use view from the argument instead of on self | Thu 20:56, herr kaste",
{},
{
"commit": "ad6d88c",
}
),
(
"| ● 153dca0 (HEAD, tag: 2.20.0) Merge branch 'dev' (2 months ago) <herr kaste>",
{},
{
"commit": "153dca0",
"HEAD": "153dca0",
"tags": ["2.20.0"]
}
),
]
class TestDescribeGraphLine(DeferrableTestCase):
@p.expand(examples)
def test_a(self, input_line, branches, output):
self.assertEqual(output, describe_graph_line(input_line, branches))