def assert_no_deprecation_warning() -> Generator[None, None, None]:
    """Context manager to assert that code does not issue any deprecation warnings."""
    with warnings.catch_warnings():
        warnings.simplefilter("error", DeprecationWarning)
        warnings.simplefilter("error", PendingDeprecationWarning)
        yield
Context manager to assert that code does not issue any deprecation warnings.
test/deprecation/lib.py