code: def test_cancel_delete():
      schema = fields.Schema(id=fields.ID(stored=True))
      # Single segment
      with TempIndex(schema, "canceldelete1") as ix:
          w = ix.writer()
          for char in "ABCD":
              w.add_document(id=char)
          w.commit()
  
          with ix.reader() as r:
              assert not r.has_deletions()
  
          w = ix.writer()
          w.delete_document(2)
          w.delete_document(3)
          w.cancel()
  
          with ix.reader() as r:
              assert not r.has_deletions()
              assert not r.is_deleted(2)
              assert not r.is_deleted(3)
  
      # Multiple segments
      with TempIndex(schema, "canceldelete2") as ix:
          for char in "ABCD":
              w = ix.writer()
              w.add_document(id=char)
              w.commit(merge=False)
  
          with ix.reader() as r:
              assert not r.has_deletions()
  
          w = ix.writer()
          w.delete_document(2)
          w.delete_document(3)
          w.cancel()
  
          with ix.reader() as r:
              assert not r.has_deletions()
              assert not r.is_deleted(2)
              assert not r.is_deleted(3)
  
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 10 for calling a global function with example usage: test_cancel_delete() without return types