code: def assert_class_wrapper_correctly_passes_arguments(
      monkeypatch,
      decomposition_function,
      DecompositionClass,
      ignore_args=None,
      decomposition_output_length=2,
      **extra_args,
  ):
      """Used to ensure that all arguments are passed correctly from the decomposition class to the decomposition function
  
      This code must be used in a test ran with the PyTest framework.
  
      Arguments:
      ----------
      monkeypatch : pytest.monkeypatch
          Monkeypatch fixture
      decomposition_function : Function
          Decomposition function wrapped by the class
      DecompositionClass : Class
          Class that wraps the function
      ignore_args : iterable
          List of arguments that shouldn't be checked
      decomposition_output_length : int
          Number of outputs from the decomposition function
      **extra_args
          Extra keyword-arguments passed to the decomposition class
  
      Example:
      --------
  
      Here is a simple example to check that the CP class' arguments match that of the parafac function.
  
      >>> from tensorly.decomposition import parafac, CP
      ... def test_cp(monkeypatch):
      ...     assert_class_wrapper_correctly_passes_arguments(monkeypatch, parafac, CP, ignore_args={'return_errors'}, rank=3)
      """
      kwargs = _get_defaultkwargs(decomposition_function)
      test_kwargs = {
          argument: "this_is_used_to_test_correct_passing_of_arguments"
          for argument in kwargs
      }
      if ignore_args is not None:
          for arg in ignore_args:
              del test_kwargs[arg]
      decomposition_checker = _get_decomposition_checker(
          test_kwargs, decomposition_output_length
      )
  
      decomposition_module = sys.modules[
          decomposition_function.__module__
      ]
      monkeypatch.setattr(
          decomposition_module,
          decomposition_function.__name__,
          decomposition_checker,
      )
      DecompositionClass(**extra_args, **test_kwargs).fit(None)
  
file_path: tensorly/tensorly/testing.py
imports: import sys
  from inspect import getfullargspec
  import numpy
  from tensorly import backend
label_desc: Use image node_id 7 for calling a global function with example usage: assert_class_wrapper_correctly_passes_arguments(monkeypatch, decomposition_function, DecompositionClass, ignore_args, decomposition_output_length) without return types