Changeset View
Changeset View
Standalone View
Standalone View
swh/graph/tests/test_api_client.py
Show All 27 Lines | def test_stats(graph_client): | ||||
assert stats["indegree"]["min"] == 0 | assert stats["indegree"]["min"] == 0 | ||||
assert stats["indegree"]["max"] == 3 | assert stats["indegree"]["max"] == 3 | ||||
assert isinstance(stats["indegree"]["avg"], float) | assert isinstance(stats["indegree"]["avg"], float) | ||||
assert stats["outdegree"]["min"] == 0 | assert stats["outdegree"]["min"] == 0 | ||||
assert stats["outdegree"]["max"] == 3 | assert stats["outdegree"]["max"] == 3 | ||||
assert isinstance(stats["outdegree"]["avg"], float) | assert isinstance(stats["outdegree"]["avg"], float) | ||||
def test_missing_args_endpoints(graph_client): | |||||
# just a few examples, not exhaustive | |||||
with raises(RemoteException) as exc_info: | |||||
list(graph_client.leaves_BR()) | |||||
assert exc_info.value.response.status_code == 400 | |||||
with raises(RemoteException) as exc_info: | |||||
list(graph_client.neighbors_BR()) | |||||
assert exc_info.value.response.status_code == 400 | |||||
with raises(RemoteException) as exc_info: | |||||
list(graph_client.random_walk_BR()) | |||||
assert exc_info.value.response.status_code == 400 | |||||
def test_leaves(graph_client): | def test_leaves(graph_client): | ||||
actual = list( | actual = list( | ||||
graph_client.leaves("swh:1:ori:0000000000000000000000000000000000000021") | graph_client.leaves("swh:1:ori:0000000000000000000000000000000000000021") | ||||
) | ) | ||||
expected = [ | expected = [ | ||||
"swh:1:cnt:0000000000000000000000000000000000000001", | "swh:1:cnt:0000000000000000000000000000000000000001", | ||||
"swh:1:cnt:0000000000000000000000000000000000000004", | "swh:1:cnt:0000000000000000000000000000000000000004", | ||||
"swh:1:cnt:0000000000000000000000000000000000000005", | "swh:1:cnt:0000000000000000000000000000000000000005", | ||||
▲ Show 20 Lines • Show All 260 Lines • Show Last 20 Lines |