Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zhixiong-tang committed Feb 16, 2024
1 parent 01d9404 commit 422ed2c
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions tests/test_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -1246,20 +1246,38 @@ def test_indexer():

def test_sequences():
G = graph1()
path = G.shortest_zigzag_path("w4", "w2", cutoff=30)
path = G.shortest_path("w1", "w7", cutoff=37.0, source_offset=3.0)
assert path.to_dict() == {
"dist": 10.0,
"nodes": ["w4", "w3", "w2"],
"directions": [-1, -1, 1],
"dist": 37.0,
"nodes": ["w1", "w2", "w5", "w7"],
"start": ("w1", 3.0),
"end": ("w7", None),
}
seqs = G.encode_sequences(
[
["w2", "w7"],
["w3", "w2"],
["w2", "w5"],
["w2", "w5", "w7"],
]
)
hits = path.search_for_seqs(seqs)
hits = {i: [p.nodes for p in s] for i, s in hits.items()}
assert hits == {1: [["w2", "w5"]]}
hits = path.search_for_seqs(seqs, quick_return=False)
hits = {i: [p.nodes for p in s] for i, s in hits.items()}
assert {1: [["w2", "w5"], ["w2", "w5", "w7"]]}

seqs = G.encode_sequences(
[
["w2", "w5", "w7"],
["w2", "w5"],
]
)
hits = path.search_for_seqs(seqs)
assert hits is not None # TODO
hits = {i: [p.nodes for p in s] for i, s in hits.items()}
assert hits == {1: [["w2", "w5", "w7"]]}
hits = path.search_for_seqs(seqs, quick_return=False)
hits = {i: [p.nodes for p in s] for i, s in hits.items()}
assert {1: [["w2", "w5", "w7"], ["w2", "w5"]]}


def test_ubodt():
Expand Down

0 comments on commit 422ed2c

Please sign in to comment.