Skip to content

Commit

Permalink
Add trie walk test of partial leaf traversal
Browse files Browse the repository at this point in the history
Recently, there was a fix for incorrectly raising a TraversedPartialPath
when traversing into a leaf, even if the suffix of the leaf did not
match the traversal path. See:
#114

This bug was actually found during a hypothesis run during a trie walk.
Although there are new unit tests making sure the leaf traversal works
properly, it seems worth adding the example explicitly as a kind of
backup test that the scenario works properly during a trie walk &
backfill.
  • Loading branch information
carver committed Jun 18, 2020
1 parent 5d61b2c commit c685189
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_hexary_trie_walk.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@ def test_trie_walk_backfilling_with_traverse_from(trie_keys, minimum_value_lengt
index_nibbles=[],
index_nibbles2=[],
)
@example(
# Catch bug where TraversedPartialPath is raised when traversing into a leaf,
# even though the leaf suffix doesn't match the prefix that was being traversed to.
trie_keys=[b'\x00\x00\x00', b'\x10\x00\x00'],
minimum_value_length=26,
number_explorations=86,
trie_changes=[(1, None)],
index_nibbles=[],
index_nibbles2=[],
)
def test_trie_walk_root_change_with_traverse(
trie_keys,
minimum_value_length,
Expand Down

0 comments on commit c685189

Please sign in to comment.