code: def test_messages(caplog: pytest.LogCaptureFixture) -> None:
      caplog.set_level(logging.INFO)
      logger.info("boo %s", "arg")
      logger.info("bar %s\nbaz %s", "arg1", "arg2")
      assert "boo arg" == caplog.messages[0]
      assert "bar arg1\nbaz arg2" == caplog.messages[1]
      assert caplog.text.count("\n") > len(caplog.messages)
      assert len(caplog.text.splitlines()) > len(caplog.messages)
  
      try:
          raise Exception("test")
      except Exception:
          logger.exception("oops")
  
      assert "oops" in caplog.text
      assert "oops" in caplog.messages[-1]
      # Tracebacks are stored in the record and not added until the formatter or handler.
      assert "Exception" in caplog.text
      assert "Exception" not in caplog.messages[-1]
  
imports: import logging
  from typing import Iterator
  import pytest
  from _pytest.logging import caplog_records_key
  from _pytest.pytester import Pytester
label_desc: Use image node_id 13 for calling a global function with example usage: test_messages(caplog) without return types