code: def _kernel_shap_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,
      expected_coefs: Union[
          None, List[float], List[List[float]]
      ] = None,
      show_progress: bool = False,
  ) -> None:
      for batch_size in perturbations_per_eval:
          kernel_shap = KernelShap(model)
          attributions = kernel_shap.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 expected_coefs is not None:
              set_all_random_seeds(1234)
              # Test with return_input_shape = False
              attributions = kernel_shap.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,
                  return_input_shape=False,
                  show_progress=show_progress,
              )
              assertTensorAlmostEqual(
                  self,
                  attributions,
                  expected_coefs,
                  delta=delta,
                  mode="max",
              )
  
imports: import io
  import unittest
  import unittest.mock
  from typing import Any, Callable, List, Tuple, Union
  import torch
  from captum._utils.typing import BaselineType, TensorOrTupleOfTensorsGeneric
  from captum.attr._core.kernel_shap import KernelShap
  from tests.helpers.basic import assertTensorAlmostEqual, assertTensorTuplesAlmostEqual, BaseTest, set_all_random_seeds
  from tests.helpers.basic_models import BasicLinearModel, BasicModel_MultiLayer, BasicModel_MultiLayer_MultiInput
label_desc: Use image node_id 24 for calling the Test obj's underlying member method code with example usage: obj._kernel_shap_test_assert(model, test_input, expected_attr, feature_mask, additional_input, perturbations_per_eval, baselines, target, n_samples, delta, expected_coefs, show_progress) without return types