code: def test_decorator_invalid_cost_func(particles):
      """Test if ValueError is raised whenever an invalid cost function is passed"""
  
      def objective_func(x):
          """Returns a numpy.ndarray instead of int or float"""
          return np.array([1, 3])
  
      @cost
      def cost_func_with_wrong_output_shape_decorated(x):
          cost = objective_func(x)
          return cost
  
      with pytest.raises(ValueError):
          cost_func_with_wrong_output_shape_decorated(particles)
  
imports: import numpy
  import pytest
  from pyswarms.utils.decorators import cost
label_desc: Use image node_id 2 for calling a global function with example usage: test_decorator_invalid_cost_func(particles) and returns: np, cost