code: def test_encode_decode_type_spec(self):
      spec = tf.TensorSpec((1, 5), tf.float32)
      string = json_utils.Encoder().encode(spec)
      loaded = json_utils.decode(string)
      self.assertEqual(spec, loaded)
  
      invalid_type_spec = {
          "class_name": "TypeSpec",
          "type_spec": "Invalid Type",
          "serialized": None,
      }
      string = json_utils.Encoder().encode(invalid_type_spec)
      with self.assertRaisesRegexp(
          ValueError, "No TypeSpec has been registered"
      ):
          loaded = json_utils.decode(string)
  
file_path: keras/keras/legacy/saving/json_utils_test.py
imports: import enum
  import pytest
  from keras import backend
  from keras import testing
  from keras.legacy.saving import json_utils
label_desc: Use image node_id 2 for calling the JsonUtilsTestTF obj's underlying member method code with example usage: obj.test_encode_decode_type_spec() without return types