Esempio n. 1
0
    def test_create_creates_empty_graph_for_empty_graph(self):
        empty_graph = Graph()

        cycle_graph = sut.create(Graph(), empty_graph, empty_graph.cycles())
        nodes = cycle_graph.nodes()

        self.assertEqual(len(nodes), 0)
Esempio n. 2
0
    def test_create_creates_empty_graph_for_graph_without_cycles(self):
        graph = Graph()
        graph.add_node("1")
        graph.add_node("2")
        graph.add_node("3")
        # cycle 1
        graph.add_edge("1", "2")
        graph.add_edge("2", "3")

        cycle_graph = sut.create(Graph(), graph, graph.cycles())
        nodes = cycle_graph.nodes()

        self.assertEqual(len(nodes), 0)
Esempio n. 3
0
    def test_create_creates_expected_graph_for_simple_cycle(self):
        graph = Graph()
        graph.add_node("1")
        graph.add_node("2")
        graph.add_node("3")
        graph.add_node("4")
        # cycle 1
        graph.add_edge("1", "2")
        graph.add_edge("2", "3")
        graph.add_edge("3", "1")

        cycle_graph = sut.create(Graph(), graph, graph.cycles())
        nodes = cycle_graph.nodes().values()

        self.assertEqual([node.label for node in nodes], ["3", "2", "1"])
Esempio n. 4
0
 def cycle_graph(self, cycles):
     graph = ProjectGraph([])
     cyclegraph.create(graph, self, cycles)
     return graph
Esempio n. 5
0
 def cycle_graph(self, cycles):
     graph = ClassDiagramm([])
     cyclegraph.create(graph, self, cycles, grouped=True)
     return graph
Esempio n. 6
0
 def cycle_graph(self, cycles):
     graph = PackageGraph([])
     cyclegraph.create(graph, self, cycles)
     return graph