code: def test_writer_reuse():
      s = fields.Schema(key=fields.ID)
      ix = RamStorage().create_index(s)
  
      w = ix.writer()
      w.add_document(key=u("A"))
      w.add_document(key=u("B"))
      w.add_document(key=u("C"))
      w.commit()
  
      # You can't re-use a commited/canceled writer
      pytest.raises(IndexingError, w.add_document, key=u("D"))
      pytest.raises(IndexingError, w.update_document, key=u("B"))
      pytest.raises(IndexingError, w.delete_document, 0)
      pytest.raises(IndexingError, w.add_reader, None)
      pytest.raises(IndexingError, w.add_field, "name", fields.ID)
      pytest.raises(IndexingError, w.remove_field, "key")
      pytest.raises(IndexingError, w.searcher)
  
imports: from __future__ import with_statement
  import random
  from collections import defaultdict
  from datetime import datetime
  import pytest
  from whoosh import analysis, fields, index, qparser, query, __version__
  from whoosh.compat import b, u, xrange, text_type, permutations
  from whoosh.filedb.filestore import RamStorage
  from whoosh.writing import IndexingError
  from whoosh.util.numeric import length_to_byte, byte_to_length
  from whoosh.util.testing import TempIndex, TempStorage
label_desc: Use image node_id 13 for calling a global function with example usage: test_writer_reuse() without return types