code: def _shapley_test_assert(
      self,
      model: Callable,
      test_input: TensorOrTupleOfTensorsGeneric,
      expected_attr,
      feature_mask: Union[None, TensorOrTupleOfTensorsGeneric] = None,
      additional_input: Any = None,
      perturbations_per_eval: Tuple[int, ...] = (1,),
      baselines: BaselineType = None,
      target: Union[None, int] = 0,
      n_samples: int = 100,
      delta: float = 1.0,
      test_true_shapley: bool = True,
      show_progress: bool = False,
  ) -> None:
      for batch_size in perturbations_per_eval:
          shapley_samp = ShapleyValueSampling(model)
          attributions = shapley_samp.attribute(
              test_input,
              target=target,
              feature_mask=feature_mask,
              additional_forward_args=additional_input,
              baselines=baselines,
              perturbations_per_eval=batch_size,
              n_samples=n_samples,
              show_progress=show_progress,
          )
          assertTensorTuplesAlmostEqual(
              self, attributions, expected_attr, delta=delta, mode="max"
          )
          if test_true_shapley:
              shapley_val = ShapleyValues(model)
              attributions = shapley_val.attribute(
                  test_input,
                  target=target,
                  feature_mask=feature_mask,
                  additional_forward_args=additional_input,
                  baselines=baselines,
                  perturbations_per_eval=batch_size,
                  show_progress=show_progress,
              )
              assertTensorTuplesAlmostEqual(
                  self,
                  attributions,
                  expected_attr,
                  mode="max",
                  delta=0.001,
              )
  
imports: import io
  import unittest
  import unittest.mock
  from typing import Any, Callable, Tuple, Union
  import torch
  from captum._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric
  from captum.attr._core.shapley_value import ShapleyValues, ShapleyValueSampling
  from tests.helpers.basic import assertTensorTuplesAlmostEqual, BaseTest
  from tests.helpers.basic_models import BasicModel_MultiLayer, BasicModel_MultiLayer_MultiInput, BasicModelBoolInput
label_desc: Use image node_id 34 for calling the Test obj's underlying member method code with example usage: obj._shapley_test_assert(model, test_input, expected_attr, feature_mask, additional_input, perturbations_per_eval, baselines, target, n_samples, delta, test_true_shapley, show_progress) without return types