code: def test_k8s_resource_iterator():
      exception_k8s = namedtuple("Exception_k8s", "reason body")
  
      def test_callback_failing(yml_doc: dict) -> None:
          raise FailToCreateError(
              exception_k8s("the_reason", "the_body ")
          )
  
      with pytest.raises(FailToCreateError) as exc_info:
          k8s_resource_iterator(
              test_callback_failing,
              resources=yaml.safe_load_all(
                  TEST_VALID_LIST_RESOURCE_YAML
              ),
          )
  
          assert (
              str(exc_info.value)
              == "Error from server (the_reason): the_body Error from server (the_reason): the_body "
          )
  
      def callback_success(yml_doc: dict) -> None:
          return
  
      try:
          k8s_resource_iterator(
              callback_success,
              resources=yaml.safe_load_all(
                  TEST_VALID_LIST_RESOURCE_YAML
              ),
          )
  
      except FailToCreateError:
          assert False
  
imports: from __future__ import annotations
  from collections import namedtuple
  import pytest
  import yaml
  from kubernetes.utils import FailToCreateError
  from airflow.providers.cncf.kubernetes.utils.k8s_resource_iterator import k8s_resource_iterator
label_desc: Use image node_id 1 for calling a global function with example usage: test_k8s_resource_iterator() without return types