code: def test_capsys_works(capsys):
      """Sanity check that capsys can capture outputs from a global ui."""
      from dvc.ui import ui
  
      message = "hello world"
      ui.write(message)
      ui.error_write(message)
  
      captured = capsys.readouterr()
      assert captured.out == f"{message}\n"
      assert captured.err == f"{message}\n"
  
imports: import datetime
  import textwrap
  import pytest
  from dvc.ui import Console
label_desc: Use image node_id 3 for calling a global function with example usage: test_capsys_works(capsys) without return types