Ejemplo n.º 1
0
    def test_union_acycle(self, a: DiGraph, b: DiGraph, vertices, exception):
        a = AcyclicDiGraph(a)
        b = AcyclicDiGraph(b)

        if exception:
            with self.assertRaises(exception):
                a.union(b)
        else:
            a.union(b)

            self.assertEquals(set(vertices.keys()), a.vertexes())
            for edge, vertices in vertices.items():
                self.assertEquals(a.vertexes_to(edge), vertices)
Ejemplo n.º 2
0
    def test_union(self, a: DiGraph, b: DiGraph, vertices, exception):
        a.union(b)

        self.assertEquals(set(vertices.keys()), a.vertexes())
        for edge, vertices in vertices.items():
            self.assertEquals(a.vertexes_to(edge), vertices)