code: def test_pipe_string_mocked(
      capsys, mock_run, quiet, encoding="ascii"
  ):
      mock_run.return_value = subprocess.CompletedProcess(
          _common.INVALID_CMD,
          returncode=0,
          stdout="stdout",
          stderr="stderr",
      )
  
      assert (
          graphviz.pipe_string(
              "dot", "png", "nongraph", encoding=encoding, quiet=quiet
          )
          == "stdout"
      )
  
      mock_run.assert_called_once_with(
          [_common.EXPECTED_DOT_BINARY, "-Kdot", "-Tpng"],
          input="nongraph",
          encoding=encoding,
          capture_output=True,
          startupinfo=_common.StartupinfoMatcher(),
      )
      assert capsys.readouterr() == ("", "" if quiet else "stderr")
  
file_path: graphviz/tests/backend/test_piping.py
imports: import io
  import re
  import subprocess
  import pytest
  import graphviz
  import _common
label_desc: Use image node_id 5 for calling a global function with example usage: test_pipe_string_mocked(capsys, mock_run, quiet, encoding) without return types