code: def test_sample_independent(
      sampler_class: Callable[[], BaseMultiObjectiveSampler],
      distribution: BaseDistribution,
  ) -> None:
      study = optuna.multi_objective.study.create_study(
          ["minimize", "maximize"], sampler=sampler_class()
      )
      for i in range(100):
          value = study.sampler.sample_independent(
              study, _create_new_trial(study), "x", distribution
          )
          assert distribution._contains(
              distribution.to_internal_repr(value)
          )
  
          if not isinstance(distribution, CategoricalDistribution):
              # Please see https://github.com/optuna/optuna/pull/393 why this assertion is needed.
              assert not isinstance(value, np.floating)
  
          if isinstance(distribution, FloatDistribution):
              if distribution.step is not None:
                  # Check the value is a multiple of `distribution.q` which is
                  # the quantization interval of the distribution.
                  value -= distribution.low
                  value /= distribution.step
                  round_value = np.round(value)
                  np.testing.assert_almost_equal(round_value, value)
  
file_path: optuna/tests/multi_objective_tests/samplers_tests/test_samplers.py
imports: from typing import Callable
  from unittest.mock import patch
  import numpy
  import pytest
  import optuna
  from optuna import multi_objective
  from optuna.distributions import BaseDistribution
  from optuna.distributions import CategoricalDistribution
  from optuna.distributions import FloatDistribution
  from optuna.distributions import IntDistribution
  from optuna.multi_objective.samplers import BaseMultiObjectiveSampler
label_desc: Use image node_id 1 for calling a global function with example usage: test_sample_independent(sampler_class, distribution) without return types