def test_ancestors(self):
     graph = Graph()
     graph.add_edges([
         Edge('a', 'b', 1),
         Edge('a', 'c', 1),
         Edge('c', 'd', 1)])
     self.assertCountEqual(graph.ancestors('a'), ['a'])
     self.assertCountEqual(graph.ancestors('b'), ['a', 'b'])
     self.assertCountEqual(graph.ancestors('c'), ['a', 'c'])
     self.assertCountEqual(graph.ancestors('d'), ['a', 'c', 'd'])
 def test_ancestors_with_crossing_paths(self):
     graph = Graph()
     graph.add_edges([
         Edge('a', 'b', 1),
         Edge('a', 'c', 1),
         Edge('c', 'd', 1),
         Edge('b', 'd', 1)])
     self.assertCountEqual(graph.ancestors('d'), ['a', 'b', 'c', 'd'])