code: def test_save_image(self):
      (x, _), (_, _), _, _ = load_mnist(raw=True)
  
      f_name = "image1.png"
      save_image(x[0], f_name)
      path = os.path.join(config.ART_DATA_PATH, f_name)
      self.assertTrue(os.path.isfile(path))
      os.remove(path)
  
      f_name = "image2.jpg"
      save_image(x[1], f_name)
      path = os.path.join(config.ART_DATA_PATH, f_name)
      self.assertTrue(os.path.isfile(path))
      os.remove(path)
  
      folder = "images123456"
      f_name_with_dir = os.path.join(folder, "image3.png")
      save_image(x[3], f_name_with_dir)
      path = os.path.join(config.ART_DATA_PATH, f_name_with_dir)
      self.assertTrue(os.path.isfile(path))
      os.remove(path)
      os.rmdir(os.path.split(path)[0])  # Remove also test folder
  
      folder = os.path.join("images123456", "inner")
      f_name_with_dir = os.path.join(folder, "image4.png")
      save_image(x[3], f_name_with_dir)
      path_nested = os.path.join(config.ART_DATA_PATH, f_name_with_dir)
      self.assertTrue(os.path.isfile(path_nested))
      os.remove(path_nested)
      os.rmdir(
          os.path.split(path_nested)[0]
      )  # Remove inner test folder
      os.rmdir(os.path.split(path)[0])
  
file_path: adversarial-robustness-toolbox/tests/test_visualization.py
imports: from __future__ import absolute_import, division, print_function, unicode_literals
  import logging
  import os.path
  import unittest
  import numpy
  from art import config
  from art.utils import load_mnist, load_cifar10
  from art.visualization import create_sprite, convert_to_rgb, save_image, plot_3d
  from tests.utils import master_seed
label_desc: Use image node_id 2 for calling the TestVisualization obj's underlying member method code with example usage: obj.test_save_image() without return types