code: def test_cost_decorator(objective_func, particles):
      """Test if cost decorator returns the same shape and value as undecorated function"""
      n_particles = particles.shape[0]
  
      def cost_func_without_decorator(x):
          n_particles_in_func = x.shape[0]
          cost = np.array(
              [objective_func(x[i]) for i in range(n_particles_in_func)]
          )
          return cost
  
      @cost
      def cost_func_with_decorator(x):
          cost = objective_func(x)
          return cost
  
      undecorated = cost_func_without_decorator(particles)
      decorated = cost_func_with_decorator(particles)
  
      assert np.array_equal(decorated, undecorated)
      assert decorated.shape == (n_particles,)
  
imports: import numpy
  import pytest
  from pyswarms.utils.decorators import cost
label_desc: Use image node_id 1 for calling a global function with example usage: test_cost_decorator(objective_func, particles) and returns: cost, cost