code: def test_works_with_filterwarnings(pytester: Pytester) -> None:
      """Ensure our warnings capture does not mess with pre-installed filters (#2430)."""
      pytester.makepyfile(
          """
          import warnings
  
          class MyWarning(Warning):
              pass
  
          warnings.filterwarnings("error", category=MyWarning)
  
          class TestWarnings(object):
              def test_my_warning(self):
                  try:
                      warnings.warn(MyWarning("warn!"))
                      assert False
                  except MyWarning:
                      assert True
      """
      )
      result = pytester.runpytest()
      result.stdout.fnmatch_lines(["*== 1 passed in *"])
  
imports: import os
  import sys
  import warnings
  from typing import List
  from typing import Optional
  from typing import Tuple
  import pytest
  from _pytest.fixtures import FixtureRequest
  from _pytest.pytester import Pytester
label_desc: Use image node_id 7 for calling a global function with example usage: test_works_with_filterwarnings(pytester) without return types