code: def test_buffered():
      schema = fields.Schema(id=fields.ID, text=fields.TEXT)
      with TempIndex(schema, "buffered") as ix:
          domain = (
              "alfa bravo charlie delta echo foxtrot golf hotel india"
          )
          domain = domain.split()
  
          w = writing.BufferedWriter(
              ix, period=None, limit=10, commitargs={"merge": False}
          )
          for i in xrange(20):
              w.add_document(
                  id=text_type(i),
                  text=" ".join(random.sample(domain, 5)),
              )
          time.sleep(0.1)
          w.close()
  
          assert len(ix._segments()) == 2
  
imports: from __future__ import with_statement
  import random, time, threading
  import pytest
  from whoosh import analysis, fields, query, writing
  from whoosh.compat import b, u, xrange, text_type
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempIndex
label_desc: Use image node_id 5 for calling a global function with example usage: test_buffered() without return types