graph_client = <swh.graph.naive_client.NaiveClient object at 0x7f24eb317eb8>
max_edges = 5, edges = 'rel:rev,rev:rev,rev:dir'
@pytest.mark.parametrize("max_edges", [1, 2, 3, 4, 5])
@pytest.mark.parametrize("edges", ["rel:rev,rev:rev,rev:dir", "*"])
def test_visit_edges_limited(graph_client, max_edges, edges):
actual = list(
graph_client.visit_edges(
"swh:1:rel:0000000000000000000000000000000000000010",
max_edges=max_edges,
edges=edges,
)
)
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:dir:0000000000000000000000000000000000000008",
"swh:1:dir:0000000000000000000000000000000000000006",
),
(
"swh:1:dir:0000000000000000000000000000000000000008",
"swh:1:cnt:0000000000000000000000000000000000000007",
),
(
"swh:1:dir:0000000000000000000000000000000000000008",
"swh:1:cnt:0000000000000000000000000000000000000001",
),
(
"swh:1:dir:0000000000000000000000000000000000000006",
"swh:1:cnt:0000000000000000000000000000000000000005",
),
(
"swh:1:dir:0000000000000000000000000000000000000006",
"swh:1:cnt:0000000000000000000000000000000000000004",
),
(
"swh:1:rev:0000000000000000000000000000000000000003",
"swh:1:dir:0000000000000000000000000000000000000002",
),
(
"swh:1:dir:0000000000000000000000000000000000000002",
"swh:1:cnt:0000000000000000000000000000000000000001",
),
]
# 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
E assert 4 == 5
E +4
E -5
.tox/py3/lib/python3.7/site-packages/swh/graph/tests/test_api_client.py:198: AssertionError
TEST RESULT
TEST RESULT
- Run At
- May 7 2021, 2:09 AM