code: def test_export_archive_errors(self):
      temp_filepath = os.path.join(
          self.get_temp_dir(), "exported_model"
      )
      model = models.Sequential([layers.Dense(2)])
      model(tf.random.normal((2, 3)))
  
      # Endpoint name reuse
      export_archive = export_lib.ExportArchive()
      export_archive.track(model)
      export_archive.add_endpoint(
          "call",
          model.call,
          input_signature=[
              tf.TensorSpec(
                  shape=(None, 3),
                  dtype=tf.float32,
              )
          ],
      )
      with self.assertRaisesRegex(ValueError, "already taken"):
          export_archive.add_endpoint(
              "call",
              model.call,
              input_signature=[
                  tf.TensorSpec(
                      shape=(None, 3),
                      dtype=tf.float32,
                  )
              ],
          )
  
      # Write out with no endpoints
      export_archive = export_lib.ExportArchive()
      export_archive.track(model)
      with self.assertRaisesRegex(
          ValueError, "No endpoints have been set"
      ):
          export_archive.write_out(temp_filepath)
  
      # Invalid object type
      with self.assertRaisesRegex(ValueError, "Invalid resource type"):
          export_archive = export_lib.ExportArchive()
          export_archive.track("model")
  
      # Set endpoint with no input signature
      export_archive = export_lib.ExportArchive()
      export_archive.track(model)
      with self.assertRaisesRegex(
          ValueError, "you must provide an `input_signature`"
      ):
          export_archive.add_endpoint(
              "call",
              model.call,
          )
  
      # Set endpoint that has never been called
      export_archive = export_lib.ExportArchive()
      export_archive.track(model)
  
      @tf.function()
      def my_endpoint(x):
          return model(x)
  
      export_archive = export_lib.ExportArchive()
      export_archive.track(model)
      with self.assertRaisesRegex(
          ValueError, "you must either provide a function"
      ):
          export_archive.add_endpoint(
              "call",
              my_endpoint,
          )
  
imports: import os
  import numpy
  import pytest
  import tensorflow
  from keras import backend
  from keras import layers
  from keras import models
  from keras import testing
  from keras import utils
  from keras.export import export_lib
  from keras.saving import saving_lib
label_desc: Use image node_id 11 for calling the ExportArchiveTest obj's underlying member method code with example usage: obj.test_export_archive_errors() and returns: model