class_docstr: Test suite for compute_pbest()
class_docstr_tok: ["Test","suite","for","compute_pbest","(",")"]
docstr: Test if method gives the expected return values
docstr_tok: ["Test","if","method","gives","the","expected","return","values"]
code: def test_return_values(self, swarm):
      """Test if method gives the expected return values"""
      expected_cost = np.array([1, 2, 2])
      expected_pos = np.array([[1, 2, 3], [4, 5, 6], [1, 1, 1]])
      pos, cost = P.compute_pbest(swarm)
      assert (pos == expected_pos).all()
      assert (cost == expected_cost).all()
  
file_path: pyswarms/tests/backend/test_operators.py
imports: import numpy
  import pytest
  import pyswarms.backend
  from pyswarms.backend.handlers import BoundaryHandler, VelocityHandler
label_desc: Use image node_id 1 for calling the TestComputePbest obj's underlying member method code with example usage: obj.test_return_values(swarm) without return types