code: def test_stability():
      schema = fields.Schema(text=fields.TEXT)
      ix = RamStorage().create_index(schema)
      domain = u("alfa bravo charlie delta").split()
      w = ix.writer()
      for ls in permutations(domain, 3):
          w.add_document(text=u(" ").join(ls))
      w.commit()
  
      with ix.searcher() as s:
          q = query.Term("text", u("bravo"))
          last = []
          for i in xrange(s.doc_frequency("text", u("bravo"))):
              # Only un-optimized results are stable
              r = s.search(q, limit=i + 1, optimize=False)
              docnums = [hit.docnum for hit in r]
              assert docnums[:-1] == last
              last = docnums
  
imports: from __future__ import with_statement
  import pytest
  from whoosh import analysis, fields, formats, highlight, qparser, query
  from whoosh.codec.whoosh3 import W3Codec
  from whoosh.compat import u, xrange, text_type, permutations
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempStorage, TempIndex
label_desc: Use image node_id 19 for calling a global function with example usage: test_stability() without return types