def METHOD_NAME(caplog: LogCaptureFixture):
    d = {"api_server.port": 5000}
    with caplog.at_level(logging.WARNING):
        rename_fields(d, "api_server.port", remove_only=True)
    assert "Field 'api_server.port' is deprecated and will be removed." in caplog.text
    assert len(d) == 0