code: def test_random_multistream():
      letters = "abcdefghijklmnopqrstuvwxyz"
  
      def randstring(n):
          s = "".join(random.choice(letters) for _ in xrange(n))
          return s.encode("latin1")
  
      domain = {}
      for _ in xrange(100):
          name = randstring(random.randint(5, 10))
          value = randstring(2500)
          domain[name] = value
  
      outfiles = dict(
          (name, BytesIO(value)) for name, value in domain.items()
      )
  
      with TempStorage() as st:
          msw = compound.CompoundWriter(st, buffersize=1024)
          mfiles = {}
          for name in domain:
              mfiles[name] = msw.create_file(name)
          while outfiles:
              name = random.choice(list(outfiles.keys()))
              v = outfiles[name].read(1000)
              mfiles[name].write(v)
              if len(v) < 1000:
                  del outfiles[name]
          f = st.create_file("test")
          msw.save_as_compound(f)
  
          f = st.open_file("test")
          msr = compound.CompoundStorage(f)
          for name, value in domain.items():
              assert msr.open_file(name).read() == value
          msr.close()
  
file_path: whoosh/tests/test_columns.py
imports: from __future__ import with_statement
  import inspect, random, sys
  from whoosh import columns, fields, query
  from whoosh.codec.whoosh3 import W3Codec
  from whoosh.compat import b, u, BytesIO, bytes_type, text_type
  from whoosh.compat import izip, xrange, dumps, loads
  from whoosh.filedb import compound
  from whoosh.filedb.filestore import RamStorage
  from whoosh.util.testing import TempIndex, TempStorage
label_desc: Use image node_id 3 for calling a global function with example usage: test_random_multistream() and returns: s