about summary refs log tree commit diff stats
path: root/test/core/graph.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/graph.py')
-rw-r--r--test/core/graph.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/core/graph.py b/test/core/graph.py
index 86175c91..33a2fc6f 100644
--- a/test/core/graph.py
+++ b/test/core/graph.py
@@ -192,3 +192,28 @@ assert(sccs == {frozenset({6}),
                 frozenset({7, 8}),
                 frozenset({3}),
                 frozenset({1, 2, 4, 5, 9})})
+
+# Equality
+graph = DiGraph()
+graph.add_edge(1, 2)
+graph.add_edge(2, 3)
+graph2 = DiGraph()
+graph2.add_edge(2, 3)
+graph2.add_edge(1, 2)
+assert graph == graph2
+
+# Copy
+graph4 = graph.copy()
+assert graph == graph4
+
+# Merge
+graph3 = DiGraph()
+graph3.add_edge(3, 1)
+graph3.add_edge(1, 4)
+graph4 += graph3
+for node in graph3.nodes():
+    assert node in graph4.nodes()
+for edge in graph3.edges():
+    assert edge in graph4.edges()
+assert graph4.nodes() == graph.nodes().union(graph3.nodes())
+assert sorted(graph4.edges()) == sorted(graph.edges() + graph3.edges())