code: def test_swapping_prob() -> None:
      multi_objective.samplers.NSGAIIMultiObjectiveSampler(
          swapping_prob=0.0
      )
      multi_objective.samplers.NSGAIIMultiObjectiveSampler(
          swapping_prob=0.5
      )
      multi_objective.samplers.NSGAIIMultiObjectiveSampler(
          swapping_prob=1.0
      )
  
      with pytest.raises(ValueError):
          multi_objective.samplers.NSGAIIMultiObjectiveSampler(
              swapping_prob=-0.5
          )
  
      with pytest.raises(ValueError):
          multi_objective.samplers.NSGAIIMultiObjectiveSampler(
              swapping_prob=1.1
          )
  
file_path: optuna/tests/multi_objective_tests/samplers_tests/test_nsga2.py
imports: from collections import Counter
  from typing import List
  from typing import Tuple
  from unittest.mock import patch
  import pytest
  import optuna
  from optuna import multi_objective
  from optuna.study._study_direction import StudyDirection
label_desc: Use image node_id 4 for calling a global function with example usage: test_swapping_prob() without return types