graph_client = <RemoteGraphClient url=http://127.0.0.1:37813/graph/>
max_edges = 3
@pytest.mark.parametrize("max_edges", [1, 2, 3, 4, 5])
def test_visit_edges_limited(graph_client, max_edges):
actual = list(
graph_client.visit_edges(
"swh:1:rel:0000000000000000000000000000000000000010",
max_edges=max_edges,
edges="rel:rev,rev:rev,rev:dir",
)
)
expected = [
(
"swh:1:rel:0000000000000000000000000000000000000010",
"swh:1:rev:0000000000000000000000000000000000000009",
),
(
"swh:1:rev:0000000000000000000000000000000000000009",
"swh:1:rev:0000000000000000000000000000000000000003",
),
(
"swh:1:rev:0000000000000000000000000000000000000009",
"swh:1:dir:0000000000000000000000000000000000000008",
),
(
"swh:1:rev:0000000000000000000000000000000000000003",
"swh:1:dir:0000000000000000000000000000000000000002",
),
]
# As there are multiple valid answers for every value of max_edges (<= 3),
# we cannot check for equality.
# Instead, we check the client returned all edges but one.
assert set(actual).issubset(set(expected))
> assert len(actual) == max_edges - 1
E assert 1 == 2
E +1
E -2
.tox/py3/lib/python3.7/site-packages/swh/graph/tests/test_api_client.py:172: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 5 2021, 10:51 AM