code: def test_version():
      # we just get a version if not asking for a version of some command
      stdout, stderr = run_main(["--version"], expect_stderr=True)
      eq_(stdout.rstrip(), "datalad %s" % datalad.__version__)
  
      stdout, stderr = run_main(
          ["clone", "--version"], expect_stderr=True
      )
      ok_startswith(stdout, "datalad %s\n" % datalad.__version__)
      # since https://github.com/datalad/datalad/pull/2733 no license in --version
      assert_not_in("Copyright", stdout)
      assert_not_in("Permission is hereby granted", stdout)
  
      try:
          import datalad_container
      except ImportError:
          pass  # not installed, cannot test with extension
      else:
          stdout, stderr = run_main(
              ["containers-list", "--version"], expect_stderr=True
          )
          eq_(
              stdout,
              "datalad_container %s\n" % datalad_container.__version__,
          )
  
imports: import os
  import re
  from io import StringIO
  from unittest.mock import patch
  import pytest
  import datalad
  from datalad import __version__
  from datalad.api import Dataset, create
  from datalad.cmd import StdOutErrCapture
  from datalad.cmd import WitlessRunner
  from datalad.interface.base import get_interface_groups
  from datalad.tests.utils_pytest import SkipTest, assert_equal, assert_in, assert_not_in, assert_raises, assert_re_in, eq_, in_, ok_, ok_startswith, on_windows, skip_if_no_module, slow, with_tempfile
  from datalad.ui.utils import get_console_width, get_terminal_size
  from datalad.utils import chpwd
  from ..helpers import get_commands_from_groups
  from ..main import main
label_desc: Use image node_id 4 for calling a global function with example usage: test_version() without return types