class_docstr: Test suite for compute_position()
class_docstr_tok: ["Test","suite","for","compute_position","(",")"]
docstr: Test if method gives the expected shape and range
docstr_tok: ["Test","if","method","gives","the","expected","shape","and","range"]
code: def test_return_values(self, swarm, bounds, bh_strat):
      """Test if method gives the expected shape and range"""
      bh = BoundaryHandler(strategy=bh_strat)
      p = P.compute_position(swarm, bounds, bh)
      assert p.shape == swarm.velocity.shape
      if bounds is not None:
          assert (bounds[0] <= p).all() and (bounds[1] >= p).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 TestComputePosition obj's underlying member method code with example usage: obj.test_return_values(swarm, bounds, bh_strat) without return types