code: def test_batched_command():
      bc = BatchedCommand(cmd=[sys.executable, "-i", "-u", "-q", "-"])
      response = bc("print('a')")
      assert_equal(response, "a")
      response = bc("print(2 + 1)")
      assert_equal(response, "3")
      stderr = bc.close(return_stderr=True)
      assert_is_not_none(stderr)
  
file_path: datalad/datalad/tests/test_cmd.py
imports: import sys
  import unittest.mock
  from subprocess import TimeoutExpired
  import pytest
  from datalad.cmd import BatchedCommand, readline_rstripped
  from datalad.cmd import BatchedCommandError
  from datalad.runner.tests.utils import py2cmd
  from datalad.tests.utils_pytest import assert_equal, assert_is_none, assert_is_not_none, assert_not_equal, assert_true
label_desc: Use image node_id 2 for calling a global function with example usage: test_batched_command() without return types