code: def test_automaton():
      schema = fields.Schema(text=fields.TEXT)
      with TempIndex(schema, "automatonspell") as ix:
          with ix.writer() as w:
              w.add_document(text=" ".join(_wordlist))
  
          with ix.reader() as r:
              bterms = list(r.lexicon("text"))
              words = [bterm.decode("utf8") for bterm in bterms]
              assert words == _wordlist
  
              typo = "reoction"
              sugs = list(r.terms_within("text", typo, maxdist=2))
              target = [
                  w for w in _wordlist if levenshtein(typo, w) <= 2
              ]
              assert sugs == target
  
imports: from __future__ import with_statement
  import gzip
  from whoosh import analysis, fields, highlight, query, spelling
  from whoosh.compat import u
  from whoosh.qparser import QueryParser
  from whoosh.support.levenshtein import levenshtein
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 2 for calling a global function with example usage: test_automaton() without return types