code: def test_exotic_weights(self):
      # Test the use of weights that are not integer or floats, but e.g.
      # complex numbers or object types.
  
      # Complex weights
      values = np.array([1.3, 2.5, 2.3])
      weights = np.array([1, -1, 2]) + 1j * np.array([2, 1, 2])
  
      # Check with custom bins
      wa, wb = histogram(values, bins=[0, 2, 3], weights=weights)
      assert_array_almost_equal(
          wa, np.array([1, 1]) + 1j * np.array([2, 3])
      )
  
      # Check with even bins
      wa, wb = histogram(values, bins=2, range=[1, 3], weights=weights)
      assert_array_almost_equal(
          wa, np.array([1, 1]) + 1j * np.array([2, 3])
      )
  
      # Decimal weights
      from decimal import Decimal
  
      values = np.array([1.3, 2.5, 2.3])
      weights = np.array([Decimal(1), Decimal(2), Decimal(3)])
  
      # Check with custom bins
      wa, wb = histogram(values, bins=[0, 2, 3], weights=weights)
      assert_array_almost_equal(wa, [Decimal(1), Decimal(5)])
  
      # Check with even bins
      wa, wb = histogram(values, bins=2, range=[1, 3], weights=weights)
      assert_array_almost_equal(wa, [Decimal(1), Decimal(5)])
  
imports: import numpy
  from numpy.lib.histograms import histogram, histogramdd, histogram_bin_edges
  from numpy.testing import assert_, assert_equal, assert_array_equal, assert_almost_equal, assert_array_almost_equal, assert_raises, assert_allclose, assert_array_max_ulp, assert_raises_regex, suppress_warnings
  from numpy.testing._private.utils import requires_memory
  import pytest
label_desc: Use image node_id 12 for calling the TestHistogram obj's underlying member method code with example usage: obj.test_exotic_weights() without return types