code: def test_snapshot_ls(self):
      self.__set_variables()
  
      # create a visible snapshot
      self.snapshot_command.parse(
          ["snapshot", "create", "-m", "my test snapshot"]
      )
  
      created_snapshot_obj = self.snapshot_command.execute()
  
      # Test when optional parameters are not given
      self.snapshot_command.parse(["snapshot", "ls"])
  
      result = self.snapshot_command.execute()
  
      assert result
      assert created_snapshot_obj in result
      # Check if current snapshot id is the same as the latest created id
      current_snapshot_obj = (
          self.snapshot_command.snapshot_controller.current_snapshot()
      )
      current_snapshot_id = (
          current_snapshot_obj.id if current_snapshot_obj else None
      )
      assert current_snapshot_id == created_snapshot_obj.id
  
      # Test when optional parameters are not given
      self.snapshot_command.parse(["snapshot", "ls", "--details"])
  
      result = self.snapshot_command.execute()
  
      assert result
      assert created_snapshot_obj in result
  
      # Test failure (format)
      failed = False
      try:
          self.snapshot_command.parse(["snapshot", "ls", "--format"])
      except ArgumentError:
          failed = True
      assert failed
  
      # Test success format csv
      self.snapshot_command.parse(["snapshot", "ls", "--format", "csv"])
      snapshot_objs = self.snapshot_command.execute()
      assert created_snapshot_obj in snapshot_objs
  
      # Test success format csv, download default
      self.snapshot_command.parse(
          ["snapshot", "ls", "--format", "csv", "--download"]
      )
      snapshot_objs = self.snapshot_command.execute()
      assert created_snapshot_obj in snapshot_objs
      test_wildcard = os.path.join(
          self.snapshot_command.snapshot_controller.home,
          "snapshot_ls_*",
      )
      paths = [n for n in glob.glob(test_wildcard) if os.path.isfile(n)]
      assert paths
      assert open(paths[0], "r").read()
      os.remove(paths[0])
  
      # Test success format csv, download exact path
      test_path = os.path.join(self.temp_dir, "my_output")
      self.snapshot_command.parse(
          [
              "snapshot",
              "ls",
              "--format",
              "csv",
              "--download",
              "--download-path",
              test_path,
          ]
      )
      snapshot_objs = self.snapshot_command.execute()
      assert created_snapshot_obj in snapshot_objs
      assert os.path.isfile(test_path)
      assert open(test_path, "r").read()
      os.remove(test_path)
  
      # Test success format table
      self.snapshot_command.parse(["snapshot", "ls"])
      environment_objs = self.snapshot_command.execute()
      assert created_snapshot_obj in snapshot_objs
  
      # Test success format table, download default
      self.snapshot_command.parse(["snapshot", "ls", "--download"])
      snapshot_objs = self.snapshot_command.execute()
      assert created_snapshot_obj in snapshot_objs
      test_wildcard = os.path.join(
          self.snapshot_command.snapshot_controller.home,
          "snapshot_ls_*",
      )
      paths = [n for n in glob.glob(test_wildcard) if os.path.isfile(n)]
      assert paths
      assert open(paths[0], "r").read()
      os.remove(paths[0])
  
      # Test success format table, download exact path
      test_path = os.path.join(self.temp_dir, "my_output")
      self.snapshot_command.parse(
          ["snapshot", "ls", "--download", "--download-path", test_path]
      )
      snapshot_objs = self.snapshot_command.execute()
      assert created_snapshot_obj in snapshot_objs
      assert os.path.isfile(test_path)
      assert open(test_path, "r").read()
      os.remove(test_path)
  
imports: from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import os
  import glob
  import time
  import json
  import tempfile
  import platform
  from io import open
  from argparse import ArgumentError
  from datmo.config import Config
  from datmo.cli.driver.helper import Helper
  from datmo.cli.command.project import ProjectCommand
  from datmo.cli.command.snapshot import SnapshotCommand
  from datmo.cli.command.run import RunCommand
  from datmo.core.util.exceptions import ProjectNotInitialized, MutuallyExclusiveArguments, SnapshotCreateFromTaskArgs
  from datmo.core.util.misc_functions import pytest_docker_environment_failed_instantiation
label_desc: Use image node_id 16 for calling the TestSnapshotCommand obj's underlying member method code with example usage: obj.test_snapshot_ls() without return types