docstr: Tests the integration of SpecDict with the check_input_specs.
docstr_tok: ["Tests","the","integration","of","SpecDict","with","the","check_input_specs","."]
code: def test_spec_check_integration(self):
      """Tests the integration of SpecDict with the check_input_specs."""
  
      class Model:
          @property
          def nested_key_spec(self):
              return ["a", ("b", "c"), ("d",), ("e", "f"), ("e", "g")]
  
          @property
          def dict_key_spec_with_none_leaves(self):
              return {
                  "a": None,
                  "b": {
                      "c": None,
                  },
                  "d": None,
                  "e": {
                      "f": None,
                      "g": None,
                  },
              }
  
          @property
          def spec_with_type_and_tensor_leaves(self):
              return {
                  "a": TypeClass1,
                  "b": TensorSpec("b, h", h=3, framework="np"),
              }
  
          @check_input_specs(
              "nested_key_spec", only_check_on_retry=False
          )
          def forward_nested_key(self, input_dict):
              return input_dict
  
          @check_input_specs(
              "dict_key_spec_with_none_leaves",
              only_check_on_retry=False,
          )
          def forward_dict_key_with_none_leaves(self, input_dict):
              return input_dict
  
          @check_input_specs(
              "spec_with_type_and_tensor_leaves",
              only_check_on_retry=False,
          )
          def forward_spec_with_type_and_tensor_leaves(
              self, input_dict
          ):
              return input_dict
  
      model = Model()
  
      # test nested key spec
      input_dict_1 = {
          "a": 1,
          "b": {
              "c": 2,
              "foo": 3,
          },
          "d": 3,
          "e": {
              "f": 4,
              "g": 5,
          },
      }
  
      # should run fine
      model.forward_nested_key(input_dict_1)
      model.forward_dict_key_with_none_leaves(input_dict_1)
  
      # test missing key
      input_dict_2 = {
          "a": 1,
          "b": {
              "c": 2,
              "foo": 3,
          },
          "d": 3,
          "e": {
              "f": 4,
          },
      }
  
      self.assertRaises(
          SpecCheckingError,
          lambda: model.forward_nested_key(input_dict_2),
      )
  
      self.assertRaises(
          SpecCheckingError,
          lambda: model.forward_dict_key_with_none_leaves(input_dict_2),
      )
  
      input_dict_3 = {
          "a": TypeClass1(),
          "b": np.array([1, 2, 3]),
      }
  
      # should raise shape mismatch
      self.assertRaises(
          SpecCheckingError,
          lambda: model.forward_spec_with_type_and_tensor_leaves(
              input_dict_3
          ),
      )
  
file_path: ray/rllib/core/models/specs/tests/test_spec_dict.py
imports: import unittest
  import numpy
  from ray.rllib.core.models.specs.specs_base import TensorSpec
  from ray.rllib.core.models.specs.specs_dict import SpecDict
  from ray.rllib.core.models.specs.checker import check_input_specs, convert_to_canonical_format
  from ray.rllib.core.models.specs.checker import SpecCheckingError
label_desc: Use image node_id 3 for calling the TestSpecDict obj's underlying member method code with example usage: obj.test_spec_check_integration() and returns: list, dict, dict, input_dict, input_dict, input_dict