code: def test_command_error_rendering() -> None:
      command_error = CommandError(
          cmd="<cmd>",
          msg="<msg>",
          code=1,
          stdout="<stdout>",
          stderr="<stderr>",
          cwd="<cwd>",
          kwarg1="<kwarg1>",
          kwarg2="<kwarg2>",
      )
  
      result = command_error.to_str()
      assert_equal(
          result,
          "CommandError: '<cmd>' failed with exitcode 1 under <cwd> [<msg>] "
          "[info keys: kwarg1, kwarg2] [out: '<stdout>'] [err: '<stderr>']",
      )
  
      result = command_error.to_str(False)
      assert_equal(
          result,
          "CommandError: '<cmd>' failed with exitcode 1 under <cwd> [<msg>] "
          "[info keys: kwarg1, kwarg2]",
      )
  
imports: from __future__ import annotations
  from datalad.tests.utils_pytest import assert_equal
  from ..exception import CommandError, _format_json_error_messages
label_desc: Use image node_id 4 for calling a global function with example usage: test_command_error_rendering() without return types