class_docstr: Test suite for compute_velocity()
class_docstr_tok: ["Test","suite","for","compute_velocity","(",")"]
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, clamp):
      """Test if method gives the expected shape and range"""
      vh = VelocityHandler(strategy="unmodified")
      v = P.compute_velocity(swarm, clamp, vh)
      assert v.shape == swarm.position.shape
      if clamp is not None:
          assert (clamp[0] <= v).all() and (clamp[1] >= v).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 TestComputeVelocity obj's underlying member method code with example usage: obj.test_return_values(swarm, clamp) without return types