code: def test_redirect(capfd):
      msg = "Should not be in log!"
      stream = StringIO()
      with redirect_stdout(stream):
          m.raw_output(msg)
      stdout, stderr = capfd.readouterr()
      assert stdout == msg
      assert stream.getvalue() == ""
  
      stream = StringIO()
      with redirect_stdout(stream):
          with m.ostream_redirect():
              m.raw_output(msg)
      stdout, stderr = capfd.readouterr()
      assert stdout == ""
      assert stream.getvalue() == msg
  
      stream = StringIO()
      with redirect_stdout(stream):
          m.raw_output(msg)
      stdout, stderr = capfd.readouterr()
      assert stdout == msg
      assert stream.getvalue() == ""
  
imports: from contextlib import redirect_stderr, redirect_stdout
  from io import StringIO
  from pybind11_tests import iostream
label_desc: Use image node_id 19 for calling a global function with example usage: test_redirect(capfd) without return types