code: def test_with_statement_filtering(
      caplog: pytest.LogCaptureFixture,
  ) -> None:
      class TestFilter(logging.Filter):
          def filter(self, record: logging.LogRecord) -> bool:
              record.msg = "filtered handler call"
              return True
  
      with caplog.at_level(logging.INFO):
          with caplog.filtering(TestFilter()):
              logger.info("handler call")
          logger.info("handler call")
  
      filtered_tuple, unfiltered_tuple = caplog.record_tuples
      assert filtered_tuple == (
          "test_fixture",
          20,
          "filtered handler call",
      )
      assert unfiltered_tuple == ("test_fixture", 20, "handler call")
  
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 10 for calling a global function with example usage: test_with_statement_filtering(caplog) and returns: True