-
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Display if an edge was traveled or not and add all edges
- Loading branch information
Showing
6 changed files
with
153 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
digraph { | ||
graph [rankdir=LR] | ||
node [fillcolor=white fontname="sans-serif" shape=rect style=filled] | ||
"save the princess" [color=black fontcolor=black style="filled, rounded"] | ||
end [color=black fontcolor=black style=filled] | ||
"start view" [color=black fontcolor=black style="filled, rounded"] | ||
"save the princess" [color=black fontcolor=black style="filled, rounded"] | ||
"start method" [color=black fontcolor=black style=filled] | ||
"start view" -> "save the princess" | ||
"start method" -> "save the princess" | ||
"save the princess" -> end | ||
"start view" [color=black fontcolor=black style="filled, rounded"] | ||
"save the princess" -> end [color=black] | ||
"start method" -> "save the princess" [color=black] | ||
"start view" -> "save the princess" [color=black] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
digraph { | ||
graph [rankdir=LR] | ||
node [fillcolor=white fontname="sans-serif" shape=rect style=filled] | ||
"start method" [color="#888888" fontcolor="#888888" style=filled] | ||
"save the princess" [color="#888888" fontcolor="#888888" style="filled, rounded"] | ||
"start view" [color="#888888" fontcolor="#888888" style="filled, rounded"] | ||
end [color="#888888" fontcolor="#888888" style=filled] | ||
"start view" -> "save the princess" | ||
"start method" -> "save the princess" | ||
"save the princess" -> end | ||
"save the princess" [color=black fontcolor=black href="{url}" peripheries=1 style="filled, rounded, bold"] | ||
"save the princess" [color=black fontcolor=black href="/simple/save_the_princess/2/" peripheries=1 style="filled, rounded, bold"] | ||
"start method" [color=black fontcolor=black peripheries=1 style="filled, bold"] | ||
"start view" [color="#888888" fontcolor="#888888" style="filled, rounded"] | ||
"save the princess" -> end [color="#888888"] | ||
"start method" -> "save the princess" [color=black] | ||
"start view" -> "save the princess" [color="#888888"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
from joeflow.utils import NoDashDiGraph | ||
|
||
|
||
class TestNoDashDiGraph: | ||
def test_node(self): | ||
graph = NoDashDiGraph() | ||
graph.node("foo", color="blue") | ||
assert list(graph) == [ | ||
"digraph {", | ||
"\tfoo [color=blue]", | ||
"}", | ||
] | ||
graph.node("foo", color="red") | ||
assert list(graph) == [ | ||
"digraph {", | ||
"\tfoo [color=red]", | ||
"}", | ||
] | ||
|
||
def test_edge(self): | ||
graph = NoDashDiGraph() | ||
graph.edge("foo", "bar", color="blue") | ||
assert list(graph) == [ | ||
"digraph {", | ||
"\tfoo -> bar [color=blue]", | ||
"}", | ||
] | ||
graph.edge("foo", "bar", color="red") | ||
assert list(graph) == [ | ||
"digraph {", | ||
"\tfoo -> bar [color=red]", | ||
"}", | ||
] | ||
|
||
def test_iter(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__()) == [ | ||
"// This is a comment.", | ||
"digraph {", | ||
"\tnode [style=filled]", | ||
"\tbar [color=green]", | ||
"\tfoo [color=red]", | ||
"\tfoo -> bar [color=blue]", | ||
"}", | ||
] | ||
|
||
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.", | ||
"{", | ||
"\tnode [style=filled]", | ||
"\tbar [color=green]", | ||
"\tfoo [color=red]", | ||
"\tfoo -> bar [color=blue]", | ||
"}", | ||
] | ||
|
||
def test_quote(self): | ||
assert NoDashDiGraph._quote("foo_bar") == '"foo bar"' | ||
|
||
def test_quote_edge(self): | ||
assert NoDashDiGraph._quote_edge("foo_bar") == '"foo bar"' |