code: def test_hash_contents():
      samp = [
          ("alfa", "bravo"),
          ("charlie", "delta"),
          ("echo", "foxtrot"),
          ("golf", "hotel"),
          ("india", "juliet"),
          ("kilo", "lima"),
          ("mike", "november"),
          ("oskar", "papa"),
          ("quebec", "romeo"),
          ("sierra", "tango"),
          ("ultra", "victor"),
          ("whiskey", "xray"),
      ]
      # Convert to bytes
      samp = set((b(k), b(v)) for k, v in samp)
  
      with TempStorage("hashcontents") as st:
          hw = HashWriter(st.create_file("test.hsh"))
          hw.add_all(samp)
          hw.close()
  
          hr = HashReader.open(st, "test.hsh")
  
          probes = list(samp)
          random.shuffle(probes)
          for key, value in probes:
              assert hr[key] == value
  
          assert set(hr.keys()) == set([k for k, v in samp])
          assert set(hr.values()) == set([v for k, v in samp])
          assert set(hr.items()) == samp
  
          hr.close()
  
file_path: whoosh/tests/test_tables.py
imports: from __future__ import with_statement
  import random
  from whoosh.compat import b, xrange, iteritems
  from whoosh.filedb.filestore import RamStorage
  from whoosh.filedb.filetables import HashReader, HashWriter
  from whoosh.filedb.filetables import OrderedHashWriter, OrderedHashReader
  from whoosh.util.testing import TempStorage
label_desc: Use image node_id 4 for calling a global function with example usage: test_hash_contents() without return types