code: def _test_raises(d, name, X, w=None, min_value=None, max_value=None):
      f = getattr(d, name)
  
      assert_raises(ValueError, f, [X])
      assert_raises(ValueError, f, X[0])
      assert_raises((ValueError, TypeError, RuntimeError), f, X[0][0])
  
      if d._initialized == True:
          assert_raises(ValueError, f, [x[:-1] for x in X])
  
          if min_value is not None:
              assert_raises(
                  ValueError, f, [[min_value - 0.1 for i in range(d.d)]]
              )
  
          if max_value is not None:
              assert_raises(
                  ValueError, f, [[max_value + 0.1 for i in range(d.d)]]
              )
      else:
          if min_value is not None:
              assert_raises(
                  ValueError, f, [[min_value - 0.1 for i in range(3)]]
              )
  
          if max_value is not None:
              assert_raises(
                  ValueError, f, [[max_value + 0.1 for i in range(3)]]
              )
  
      if w is not None:
          assert_raises(ValueError, f, [X], w)
          assert_raises(ValueError, f, X, [w])
          assert_raises(ValueError, f, [X], [w])
          assert_raises(ValueError, f, X, w[: len(w) - 1])
          assert_raises(ValueError, f, X[: len(X) - 1], w)
  
file_path: pomegranate/tests/distributions/_utils.py
imports: import numpy
  import torch
  from nose.tools import assert_raises
  from numpy.testing import assert_array_almost_equal
label_desc: Use image node_id 5 for calling a global function with example usage: _test_raises(d, name, X, w, min_value, max_value) without return types