code: def test_shingles():
      ana = analysis.RegexTokenizer(r"\w+") | analysis.ShingleFilter(
          3, " "
      )
      source = u("better a witty fool than a foolish wit")
      results = [
          t.copy() for t in ana(source, positions=True, chars=True)
      ]
      assert [t.text for t in results] == [
          u("better a witty"),
          u("a witty fool"),
          u("witty fool than"),
          u("fool than a"),
          u("than a foolish"),
          u("a foolish wit"),
      ]
      assert [t.pos for t in results] == list(range(len(results)))
      for t in results:
          assert t.text == source[t.startchar : t.endchar]
  
imports: from __future__ import with_statement
  import pytest
  from whoosh import analysis, fields, qparser
  from whoosh.compat import b, u, unichr
  from whoosh.compat import dumps
  from whoosh.filedb.filestore import RamStorage
label_desc: Use image node_id 16 for calling a global function with example usage: test_shingles() without return types