##// END OF EJS Templates
tests: fixed tests for graphmod
marcink -
r1380:88bbf8f6 default
parent child Browse files
Show More
@@ -42,36 +42,44 b' def test_get_edge_color_single_parent():'
42
42
43
43
44 def test_colored_linear():
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 expected_result = [
50 expected_result = [
47 ((0, 1), [(0, 0, 1)]),
51 ('hash', (0, 1), [(0, 0, 1)], 'master'),
48 ((0, 1), [(0, 0, 1)]),
52 ('hash', (0, 1), [(0, 0, 1)], 'master'),
49 ((0, 1), []),
53 ('hash', (0, 1), [], 'master'),
50 ]
54 ]
51 assert list(graphmod._colored(dag)) == expected_result
55 assert list(graphmod._colored(dag)) == expected_result
52
56
53
57
54 def test_colored_diverging_branch():
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 expected_result = [
64 expected_result = [
57 ((0, 1), [(0, 0, 1)]),
65 ('hash', (0, 1), [(0, 0, 1)], 'stable'),
58 ((1, 2), [(0, 0, 1), (1, 0, 2)]),
66 ('hash', (1, 2), [(0, 0, 1), (1, 0, 2)], 'stable'),
59 ((0, 1), []),
67 ('hash', (0, 1), [], 'stable'),
60 ]
68 ]
61 assert list(graphmod._colored(dag)) == expected_result
69 assert list(graphmod._colored(dag)) == expected_result
62
70
63
71
64 def test_colored_merged_branch():
72 def test_colored_merged_branch():
65 dag = [
73 dag = [
66 ('node4', ['node2', 'node3']),
74 ('hash', 'node4', ['node2', 'node3'], 'stable'),
67 ('node3', ['node1']),
75 ('hash', 'node3', ['node1'], 'stable'),
68 ('node2', ['node1']),
76 ('hash', 'node2', ['node1'], 'stable'),
69 ('node1', []),
77 ('hash', 'node1', [], 'stable'),
70 ]
78 ]
71 expected_result = [
79 expected_result = [
72 ((0, 1), [(0, 0, 1), (0, 1, 2)]),
80 ('hash', (0, 1), [(0, 0, 1), (0, 1, 2)], 'stable'),
73 ((1, 2), [(0, 0, 1), (1, 1, 2)]),
81 ('hash', (1, 2), [(0, 0, 1), (1, 1, 2)], 'stable'),
74 ((0, 1), [(0, 0, 1), (1, 0, 2)]),
82 ('hash', (0, 1), [(0, 0, 1), (1, 0, 2)], 'stable'),
75 ((0, 2), []),
83 ('hash', (0, 2), [], 'stable'),
76 ]
84 ]
77 assert list(graphmod._colored(dag)) == expected_result
85 assert list(graphmod._colored(dag)) == expected_result
General Comments 0
You need to be logged in to leave comments. Login now