code: def test_load_model_uses_format_when_it_is_specified(self) -> None:
      proto = _simple_model()
      with tempfile.TemporaryDirectory() as temp_dir:
          model_path = os.path.join(temp_dir, "model.protobuf")
          onnx.save_model(proto, model_path)
          with self.assertRaises(
              google.protobuf.text_format.ParseError
          ):
              # `format` is specified. It should take precedence over the extension
              # Loading it as textproto should fail
              onnx.load_model(model_path, format="textproto")
  
          loaded_proto = onnx.load_model(model_path, format="protobuf")
          self.assertEqual(proto, loaded_proto)
  
imports: import io
  import os
  import pathlib
  import tempfile
  import unittest
  import google.protobuf.message
  import google.protobuf.text_format
  import parameterized
  import onnx
  from onnx import serialization
label_desc: Use image node_id 4 for calling the TestSaveAndLoadFileExtensions obj's underlying member method code with example usage: obj.test_load_model_uses_format_when_it_is_specified() without return types