Changeset View
Changeset View
Standalone View
Standalone View
swh/graph/tests/test_api_client.py
Show First 20 Lines • Show All 96 Lines • ▼ Show 20 Lines | def test_walk(graph_client): | ||||
)) | )) | ||||
expected = [ | expected = [ | ||||
'swh:1:dir:0000000000000000000000000000000000000016', | 'swh:1:dir:0000000000000000000000000000000000000016', | ||||
'swh:1:dir:0000000000000000000000000000000000000017', | 'swh:1:dir:0000000000000000000000000000000000000017', | ||||
'swh:1:rev:0000000000000000000000000000000000000018', | 'swh:1:rev:0000000000000000000000000000000000000018', | ||||
'swh:1:rel:0000000000000000000000000000000000000019' | 'swh:1:rel:0000000000000000000000000000000000000019' | ||||
] | ] | ||||
assert set(actual) == set(expected) | assert set(actual) == set(expected) | ||||
def test_count(graph_client): | |||||
print(graph_client) | |||||
actual = graph_client.count_leaves( | |||||
'swh:1:ori:0000000000000000000000000000000000000021' | |||||
) | |||||
assert actual == 4 | |||||
actual = graph_client.count_visit_nodes( | |||||
'swh:1:rel:0000000000000000000000000000000000000010', | |||||
edges='rel:rev,rev:rev' | |||||
) | |||||
assert actual == 3 | |||||
actual = graph_client.count_neighbors( | |||||
'swh:1:rev:0000000000000000000000000000000000000009', | |||||
direction='backward' | |||||
) | |||||
assert actual == 3 |