100
100
def test_children_ancestry1(self):
101
101
graph = self.make_known_graph(test_graph.ancestry_1)
102
self.assertEqual(['rev1'], graph._nodes[NULL_REVISION].child_keys)
102
self.assertEqual(['rev1'], graph.get_child_keys(NULL_REVISION))
103
103
self.assertEqual(['rev2a', 'rev2b'],
104
sorted(graph._nodes['rev1'].child_keys))
105
self.assertEqual(['rev3'], sorted(graph._nodes['rev2a'].child_keys))
106
self.assertEqual(['rev4'], sorted(graph._nodes['rev3'].child_keys))
107
self.assertEqual(['rev4'], sorted(graph._nodes['rev2b'].child_keys))
104
sorted(graph.get_child_keys('rev1')))
105
self.assertEqual(['rev3'], graph.get_child_keys('rev2a'))
106
self.assertEqual(['rev4'], graph.get_child_keys('rev3'))
107
self.assertEqual(['rev4'], graph.get_child_keys('rev2b'))
108
self.assertRaises(KeyError, graph.get_child_keys, 'not_in_graph')
110
def test_parent_ancestry1(self):
111
graph = self.make_known_graph(test_graph.ancestry_1)
112
self.assertEqual([NULL_REVISION], graph.get_parent_keys('rev1'))
113
self.assertEqual(['rev1'], graph.get_parent_keys('rev2a'))
114
self.assertEqual(['rev1'], graph.get_parent_keys('rev2b'))
115
self.assertEqual(['rev2a'], graph.get_parent_keys('rev3'))
116
self.assertEqual(['rev2b', 'rev3'],
117
sorted(graph.get_parent_keys('rev4')))
118
self.assertRaises(KeyError, graph.get_child_keys, 'not_in_graph')
120
def test_parent_with_ghost(self):
121
graph = self.make_known_graph(test_graph.with_ghost)
122
self.assertEqual(None, graph.get_parent_keys('g'))
109
124
def test_gdfo_ancestry_1(self):
110
125
graph = self.make_known_graph(test_graph.ancestry_1)