Show More
@@ -42,36 +42,44 b' def test_get_edge_color_single_parent():' | |||
|
42 | 42 | |
|
43 | 43 | |
|
44 | 44 | def test_colored_linear(): |
|
45 | dag = [('node3', ['node2']), ('node2', ['node1']), ('node1', [])] | |
|
45 | dag = [ | |
|
46 | ('hash', 'node3', ['node2'], 'master'), | |
|
47 | ('hash', 'node2', ['node1'], 'master'), | |
|
48 | ('hash', 'node1', [], 'master') | |
|
49 | ] | |
|
46 | 50 | expected_result = [ |
|
47 | ((0, 1), [(0, 0, 1)]), | |
|
48 | ((0, 1), [(0, 0, 1)]), | |
|
49 | ((0, 1), []), | |
|
51 | ('hash', (0, 1), [(0, 0, 1)], 'master'), | |
|
52 | ('hash', (0, 1), [(0, 0, 1)], 'master'), | |
|
53 | ('hash', (0, 1), [], 'master'), | |
|
50 | 54 | ] |
|
51 | 55 | assert list(graphmod._colored(dag)) == expected_result |
|
52 | 56 | |
|
53 | 57 | |
|
54 | 58 | def test_colored_diverging_branch(): |
|
55 | dag = [('node3', ['node1']), ('node2', ['node1']), ('node1', [])] | |
|
59 | dag = [ | |
|
60 | ('hash', 'node3', ['node1'], 'stable'), | |
|
61 | ('hash', 'node2', ['node1'], 'stable'), | |
|
62 | ('hash', 'node1', [], 'stable') | |
|
63 | ] | |
|
56 | 64 | expected_result = [ |
|
57 | ((0, 1), [(0, 0, 1)]), | |
|
58 | ((1, 2), [(0, 0, 1), (1, 0, 2)]), | |
|
59 | ((0, 1), []), | |
|
65 | ('hash', (0, 1), [(0, 0, 1)], 'stable'), | |
|
66 | ('hash', (1, 2), [(0, 0, 1), (1, 0, 2)], 'stable'), | |
|
67 | ('hash', (0, 1), [], 'stable'), | |
|
60 | 68 | ] |
|
61 | 69 | assert list(graphmod._colored(dag)) == expected_result |
|
62 | 70 | |
|
63 | 71 | |
|
64 | 72 | def test_colored_merged_branch(): |
|
65 | 73 | dag = [ |
|
66 | ('node4', ['node2', 'node3']), | |
|
67 | ('node3', ['node1']), | |
|
68 | ('node2', ['node1']), | |
|
69 | ('node1', []), | |
|
74 | ('hash', 'node4', ['node2', 'node3'], 'stable'), | |
|
75 | ('hash', 'node3', ['node1'], 'stable'), | |
|
76 | ('hash', 'node2', ['node1'], 'stable'), | |
|
77 | ('hash', 'node1', [], 'stable'), | |
|
70 | 78 | ] |
|
71 | 79 | expected_result = [ |
|
72 | ((0, 1), [(0, 0, 1), (0, 1, 2)]), | |
|
73 | ((1, 2), [(0, 0, 1), (1, 1, 2)]), | |
|
74 | ((0, 1), [(0, 0, 1), (1, 0, 2)]), | |
|
75 | ((0, 2), []), | |
|
80 | ('hash', (0, 1), [(0, 0, 1), (0, 1, 2)], 'stable'), | |
|
81 | ('hash', (1, 2), [(0, 0, 1), (1, 1, 2)], 'stable'), | |
|
82 | ('hash', (0, 1), [(0, 0, 1), (1, 0, 2)], 'stable'), | |
|
83 | ('hash', (0, 2), [], 'stable'), | |
|
76 | 84 | ] |
|
77 | 85 | assert list(graphmod._colored(dag)) == expected_result |
General Comments 0
You need to be logged in to leave comments.
Login now