code: def test_swapping_prob() -> None:
      NSGAIIISampler(swapping_prob=0.0)
      NSGAIIISampler(swapping_prob=0.5)
      NSGAIIISampler(swapping_prob=1.0)
  
      with pytest.raises(ValueError):
          NSGAIIISampler(swapping_prob=-0.5)
  
      with pytest.raises(ValueError):
          NSGAIIISampler(swapping_prob=1.1)
  
imports: from __future__ import annotations
  from collections import Counter
  from collections.abc import Sequence
  from unittest.mock import MagicMock
  from unittest.mock import patch
  import warnings
  import numpy
  import pytest
  import optuna
  from optuna.samplers import BaseSampler
  from optuna.samplers._base import _CONSTRAINTS_KEY
  from optuna.samplers._nsgaiii._elite_population_selection_strategy import _associate_individuals_with_reference_points
  from optuna.samplers._nsgaiii._elite_population_selection_strategy import _generate_default_reference_point
  from optuna.samplers._nsgaiii._elite_population_selection_strategy import _normalize_objective_values
  from optuna.samplers._nsgaiii._elite_population_selection_strategy import _preserve_niche_individuals
  from optuna.samplers._nsgaiii._elite_population_selection_strategy import _COEF
  from optuna.samplers._nsgaiii._elite_population_selection_strategy import _filter_inf
  from optuna.samplers._nsgaiii._sampler import _POPULATION_CACHE_KEY_PREFIX
  from optuna.samplers._nsgaiii._sampler import NSGAIIISampler
  from optuna.samplers.nsgaii import BaseCrossover
  from optuna.samplers.nsgaii import BLXAlphaCrossover
  from optuna.samplers.nsgaii import SBXCrossover
  from optuna.samplers.nsgaii import SPXCrossover
  from optuna.samplers.nsgaii import UNDXCrossover
  from optuna.samplers.nsgaii import UniformCrossover
  from optuna.samplers.nsgaii import VSBXCrossover
  from optuna.samplers.nsgaii._after_trial_strategy import NSGAIIAfterTrialStrategy
  from optuna.trial import create_trial
  from optuna.trial import FrozenTrial
label_desc: Use image node_id 4 for calling a global function with example usage: test_swapping_prob() without return types