code: def test_image_save_as_saves_valid_image(
      setup_image, image_format, width, height, scale
  ):
      data = setup_image
      f, filename = tempfile.mkstemp(".{}".format(image_format))
      py.image.save_as(
          data,
          filename,
          format=image_format,
          width=width,
          height=height,
          scale=scale,
      )
      if image_format in ["png", "jpeg"]:
          assert imghdr.what(filename) == image_format
      else:
          assert os.path.getsize(filename) > 0
  
      os.remove(filename)
  
file_path: plotly.py/packages/python/chart-studio/chart_studio/tests/test_plot_ly/test_image/test_image.py
imports: from __future__ import absolute_import
  import imghdr
  import tempfile
  import os
  import itertools
  import warnings
  import pytest
  import _plotly_utils.exceptions
  from chart_studio.plotly import plotly
  from chart_studio.tests.utils import PlotlyTestCase
label_desc: Use image node_id 3 for calling a global function with example usage: test_image_save_as_saves_valid_image(setup_image, image_format, width, height, scale) without return types