class_docstr: Test suite for generate_discrete_swarm() method
class_docstr_tok: ["Test","suite","for","generate_discrete_swarm","(",")","method"]
docstr: Test if binary=True returns expected values
docstr_tok: ["Test","if","binary=True","returns","expected","values"]
code: def test_generate_discrete_binary_swarm(self, binary):
      """Test if binary=True returns expected values"""
      dims = 3
      pos = P.generate_discrete_swarm(
          n_particles=2, dimensions=dims, binary=binary
      )
      if binary:
          assert len(np.unique(pos)) <= 2  # Might generate pure 0 or 1
      else:
          assert (np.max(pos, axis=1) == dims - 1).all()
  
file_path: pyswarms/tests/backend/test_generators.py
imports: import numpy
  import pytest
  import pyswarms.backend
label_desc: Use image node_id 1 for calling the TestDiscreteSwarm obj's underlying member method code with example usage: obj.test_generate_discrete_binary_swarm(binary) without return types