Skip to content

Commit

Permalink
chore: add tests for _res2hops
Browse files Browse the repository at this point in the history
  • Loading branch information
rememberYou committed Mar 18, 2021
1 parent 433971f commit e85d05c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,30 @@ def test_remove_edge(self, setup):
LOCAL_KG.remove_edge(vtx_alice, Vertex(f"{URL}#Unknown")) is False
)

def test_res2hops(self, setup):
subj = Vertex("subj")
obj = Vertex("obj")
hops = LOCAL_KG._res2hops(
subj,
[
{
"o": {
"type": "literal",
"xml:lang": "en",
"value": "obj",
},
"p": {
"type": "literal",
"xml:lang": "en",
"value": "pred",
},
},
],
)
assert isinstance(hops, list)
assert len(hops) == 1
pred = Vertex("pred", predicate=True, vprev=subj, vnext=obj)
assert hops == [(pred, obj)]

def test_valid_url(self):
KG("https://dbpedia.org/sparql")

0 comments on commit e85d05c

Please sign in to comment.