code: def test_write_image_writeable(fig1, format):
      file_name = "fig1." + format
      with open(os.path.join(images_dir, file_name), "rb") as f:
          expected_bytes = f.read()
  
      mock_file = MagicMock()
      pio.write_image(
          fig1,
          mock_file,
          format=format,
          width=700,
          height=500,
          engine="orca",
      )
  
      if mock_file.write_bytes.called:
          mock_file.write_bytes.assert_called_once_with(expected_bytes)
      elif mock_file.write.called:
          mock_file.write.assert_called_once_with(expected_bytes)
      else:
          assert "Neither write nor write_bytes was called."
  
imports: import plotly
  import plotly.io
  import plotly.graph_objs
  import os
  import shutil
  import pytest
  import sys
  import pandas
  from io import BytesIO
label_desc: Use image node_id 10 for calling a global function with example usage: test_write_image_writeable(fig1, format) without return types