From 43166f40fea2a87acaac7ae84e30a4cfb1de6662 Mon Sep 17 00:00:00 2001 From: Lucas Jeub Date: Wed, 20 Nov 2024 13:15:57 +0100 Subject: [PATCH] add test for new import option --- .../test_graphdb/test_graphdb_imports.py | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/python/tests/test_graphdb/test_graphdb_imports.py b/python/tests/test_graphdb/test_graphdb_imports.py index 836771562..0dd6fda55 100644 --- a/python/tests/test_graphdb/test_graphdb_imports.py +++ b/python/tests/test_graphdb/test_graphdb_imports.py @@ -56,3 +56,31 @@ def test_import_with_int(): g2.import_node(g.node(1)) g2.import_nodes([g.node(2), g.node(3)]) assert g2.count_nodes() == g.count_nodes() + + +def test_import_edges(): + g = Graph() + g.add_node(1, 1) + g.add_node(1, 2) + g.add_node(1, 3) + g.add_edge(1, 4, 5) + g.add_edge(1, 6, 7) + g.add_edge(1, 8, 9) + g2 = Graph() + g2.import_edges(g.edges) + assert g2.count_edges() == 3 + assert g.edges.id == g2.edges.id + + +def test_import_edges_iterator(): + g = Graph() + g.add_node(1, 1) + g.add_node(1, 2) + g.add_node(1, 3) + g.add_edge(1, 4, 5) + g.add_edge(1, 6, 7) + g.add_edge(1, 8, 9) + g2 = Graph() + g2.import_edges(iter(g.edges)) + assert g2.count_edges() == 3 + assert g.edges.id == g2.edges.id