def test_successor_predecessor_empty_trie(): t = XFastTrie(max_trie_entry_size) with pytest.raises(ValueError): t.successor(0) with pytest.raises(ValueError): t.predecessor(0)
def test_predecessor(entries, test_values): t = XFastTrie(max_trie_entry_size) for entry in entries: t += entry for val in test_values: pred = t < val if pred is not None: assert pred < val pred = t.predecessor(val) if pred.succ is not None: assert pred.succ.value >= val