1. Mike Bayer
  2. dawg


dawg / test_trie.py

from dawg import find_word, build_trie

def test_struct():
    for word in (
        print word, find_word(word)

def test_nodes_equal():
    head = build_trie([
        # at and et are equivalent.  both have tion, tab

        # ab and eb are not.  baca/baca is the same
        # but boob/barb are not.

        # not equiv.  'eg' doesnt have 'q'

    assert head.get("a") != head.get("e")

    assert head.get("at") == head.get("et")

    assert head.get("ab") != head.get("eb")

    assert head.get("ag") != head.get("eg")

    assert head.get("eg") != head.get("ag")