code: def test_run_check_input_lines_mocked(
      mocker, sentinel, mock_popen, line=b"sp\xc3\xa4m"
  ):  # noqa: N803
      mock_sys_stderr = mocker.patch(
          "sys.stderr",
          autospec=True,
          flush=mocker.Mock(),
          encoding=sentinel.encoding,
      )
  
      mock_out = mocker.create_autospec(
          bytes, instance=True, name="mock_out"
      )
      mock_err = mocker.create_autospec(
          bytes,
          instance=True,
          name="mock_err",
          **{"__len__.return_value": 1},
      )
  
      proc = mock_popen.return_value
      proc.configure_mock(
          args=_common.INVALID_CMD,
          returncode=0,
          stdin=mocker.create_autospec(io.BytesIO, instance=True),
      )
      proc.communicate.return_value = (mock_out, mock_err)
  
      result = execute.run_check(
          proc.args, input_lines=iter([line]), capture_output=True
      )
  
      # subprocess.CompletedProcess.__eq__() is not implemented
      assert isinstance(result, subprocess.CompletedProcess)
      assert result.args is proc.args
      assert result.returncode == proc.returncode
      assert result.stdout is mock_out
      assert result.stderr is mock_err
  
      mock_popen.assert_called_once_with(
          _common.INVALID_CMD,
          stdin=subprocess.PIPE,
          stdout=subprocess.PIPE,
          stderr=subprocess.PIPE,
          startupinfo=_common.StartupinfoMatcher(),
      )
      proc.communicate.assert_called_once_with()
      mock_out.decode.assert_not_called()
      mock_err.decode.assert_called_once_with(sentinel.encoding)
      mock_sys_stderr.write.assert_called_once_with(
          mock_err.decode.return_value
      )
      mock_sys_stderr.flush.assert_called_once_with()
  
file_path: graphviz/tests/backend/test_execute.py
imports: import errno
  import io
  import subprocess
  import pytest
  import graphviz
  from graphviz.backend import execute
  import _common
label_desc: Use image node_id 5 for calling a global function with example usage: test_run_check_input_lines_mocked(mocker, sentinel, mock_popen, line) without return types