code: def inject_backend_tests(method_names, params):
      if not (method_names is None or isinstance(method_names, list)):
          raise TypeError("method_names must be either None or a list.")
      if not isinstance(params, list):
          raise TypeError("params must be a list of dicts.")
      if not all(isinstance(d, dict) for d in params):
          raise TypeError("params must be a list of dicts.")
  
      return _bundle.make_decorator(
          lambda base: _test_case_generator(base, method_names, params)
      )
  
imports: import functools
  import chainer
  from chainer import backend
  from chainer.testing import _bundle
  from chainer.testing import attr
  import chainerx
label_desc: Use image node_id 2 for calling a global function with example usage: inject_backend_tests(method_names, params) and returns: _bundle