|
@@ -0,0 +1,44 @@
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+from yamily import Person, PersonCollection
|
|
|
+from yamily._graphviz import digraph
|
|
|
+
|
|
|
+
|
|
|
+def test_digraph_single_family():
|
|
|
+ collection = PersonCollection()
|
|
|
+ child = Person("child")
|
|
|
+ child.father = Person("father")
|
|
|
+ child.mother = Person("mother")
|
|
|
+ collection.add_person(child)
|
|
|
+ graph = digraph(collection)
|
|
|
+ expected_graph = """digraph yamily {
|
|
|
+ subgraph cluster_mother {
|
|
|
+ rank=same style=invisible
|
|
|
+ mother [label=mother shape=box]
|
|
|
+ "relation-father-mother" [shape=point width=0]
|
|
|
+ father -> "relation-father-mother" [arrowhead=none constraint=False]
|
|
|
+ mother -> "relation-father-mother" [arrowhead=none constraint=False]
|
|
|
+ father [label=father shape=box]
|
|
|
+ }
|
|
|
+ subgraph cluster_child {
|
|
|
+ rank=same style=invisible
|
|
|
+ child [label=child shape=box]
|
|
|
+ }
|
|
|
+ "relation-father-mother" -> child
|
|
|
+}"""
|
|
|
+ assert graph.source == expected_graph
|