code: def test_glob_optimize():
      # Issue 472: Stored dynamic field deleted after commit with optimize
  
      schema = fields.Schema()
      schema.add("f*", fields.STORED, glob=True)
  
      with TempIndex(schema, "globoptimize") as ix:
          writer = ix.writer()
  
          # Create document with dynamic fields
          writer.add_document(f1=1, f2=2)
          writer.commit()
  
          # Read back fields
          assert list(ix.reader().all_stored_fields()) == [
              {"f1": 1, "f2": 2}
          ]
  
          # Optimize
          writer = ix.writer()
          writer.commit(optimize=True)
  
          # Read fields again
          assert list(ix.reader().all_stored_fields()) == [
              {"f1": 1, "f2": 2}
          ]
  
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 29 for calling a global function with example usage: test_glob_optimize() without return types