Esempio n. 1
0
 def test_edge(self):
     graph = NoDashDiGraph()
     graph.edge("foo", "bar", color="blue")
     assert list(graph) == [
         "digraph {\n",
         "\tfoo -> bar [color=blue]\n",
         "}\n",
     ]
     graph.edge("foo", "bar", color="red")
     assert list(graph) == [
         "digraph {\n",
         "\tfoo -> bar [color=red]\n",
         "}\n",
     ]
Esempio n. 2
0
 def test_iter__subgraph(self):
     graph = NoDashDiGraph(node_attr={"style": "filled"})
     graph.node("foo", color="red")
     graph.node("bar", color="green")
     graph.edge("foo", "bar", color="blue")
     graph.comment = "This is a comment."
     print(str(graph))
     assert list(graph.__iter__(subgraph=True)) == [
         "// This is a comment.\n",
         "{\n",
         "\tnode [style=filled]\n",
         "\tbar [color=green]\n",
         "\tfoo [color=red]\n",
         "\tfoo -> bar [color=blue]\n",
         "}\n",
     ]