code: def test_index_decimals():
      from decimal import Decimal
  
      schema = fields.Schema(
          name=fields.KEYWORD(stored=True), num=fields.NUMERIC(int)
      )
      ix = RamStorage().create_index(schema)
  
      with ix.writer() as w:
          with pytest.raises(TypeError):
              w.add_document(name=u("hello"), num=Decimal("3.2"))
  
      schema = fields.Schema(
          name=fields.KEYWORD(stored=True),
          num=fields.NUMERIC(Decimal, decimal_places=5),
      )
      ix = RamStorage().create_index(schema)
      with ix.writer() as w:
          w.add_document(name=u("hello"), num=Decimal("3.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 30 for calling a global function with example usage: test_index_decimals() without return types