Skip to content

Commit

Permalink
add test for new import option
Browse files Browse the repository at this point in the history
  • Loading branch information
ljeub-pometry committed Nov 20, 2024
1 parent 1974dbe commit 43166f4
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions python/tests/test_graphdb/test_graphdb_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 43166f4

Please sign in to comment.