Skip to content

Commit 9b3daf6

Browse files
committed
new: test cases
1 parent 097f661 commit 9b3daf6

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

tests/test_document.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1832,6 +1832,14 @@ def test_document_import_bulk(col, bad_col, docs):
18321832
assert col[doc_key]["loc"] == doc["loc"]
18331833
empty_collection(col)
18341834

1835+
# Test import bulk with batch_size
1836+
results = col.import_bulk(docs, batch_size=len(docs) // 2)
1837+
assert type(results) is list
1838+
assert len(results) == 2
1839+
1840+
result = col.import_bulk(docs, batch_size=len(docs) * 2)
1841+
assert type(result) is dict
1842+
18351843
# Test import bulk on_duplicate actions
18361844
doc = docs[0]
18371845
doc_key = doc["_key"]

tests/test_graph.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,34 @@ def test_graph_properties(graph, bad_graph, db):
5757
assert isinstance(properties["revision"], str)
5858

5959

60+
def test_graph_provision(graph, db):
61+
vertices = [{"foo": i} for i in range(1, 101)]
62+
edges = [
63+
{"_from": f"numbers/{j}", "_to": f"numbers/{i}", "result": j / i}
64+
for i in range(1, 101)
65+
for j in range(1, 101)
66+
if j % i == 0
67+
]
68+
e_d = [
69+
{
70+
"edge_collection": "is_divisible_by",
71+
"from_vertex_collections": ["numbers"],
72+
"to_vertex_collections": ["numbers"],
73+
}
74+
]
75+
graph = db.create_graph(
76+
name="DivisibilityGraph",
77+
edge_definitions=e_d,
78+
collections={
79+
"numbers": {"docs": vertices, "options": {"batch_size": 5}},
80+
"is_divisible_by": {"docs": edges, "options": {"sync": True}},
81+
},
82+
)
83+
84+
assert graph.vertex_collection("numbers").count() == len(vertices)
85+
assert graph.edge_collection("is_divisible_by").count() == len(edges)
86+
87+
6088
def test_graph_management(db, bad_db):
6189
# Test create graph
6290
graph_name = generate_graph_name()

0 commit comments

Comments
 (0)