From f9738390bedf9247831f4e924bf9e1180cd0373e Mon Sep 17 00:00:00 2001 From: Rohit Kanithi Date: Sun, 13 Sep 2026 02:34:31 -0500 Subject: [PATCH] test(router_strategy): add explicit routing args test for 100% patch coverage --- .../test_base_routing_strategy.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/tests/test_litellm/router_strategy/test_base_routing_strategy.py b/tests/test_litellm/router_strategy/test_base_routing_strategy.py index ad6ceffea33..551a26f710c 100644 --- a/tests/test_litellm/router_strategy/test_base_routing_strategy.py +++ b/tests/test_litellm/router_strategy/test_base_routing_strategy.py @@ -216,3 +216,22 @@ class TestRouterStrategyInstanceIsolation: finally: await h1.cleanup() await h2.cleanup() + + @pytest.mark.asyncio + async def test_handlers_accept_explicit_routing_args(self) -> None: + """Verify handlers accept and respect explicitly provided routing_args dict.""" + mock_cache = MagicMock(spec=DualCache) + h_cost = LowestCostLoggingHandler(router_cache=mock_cache, routing_args={"custom": True}) + assert h_cost.routing_args == {"custom": True} + + h_lat = LowestLatencyLoggingHandler(router_cache=mock_cache, routing_args={"ttl": 120}) + assert h_lat.routing_args.ttl == 120 + + h_tpm = LowestTPMLoggingHandler(router_cache=mock_cache, routing_args={"ttl": 180}) + assert h_tpm.routing_args.ttl == 180 + + h_tpm_v2 = LowestTPMLoggingHandler_v2(router_cache=mock_cache, routing_args={"ttl": 240}) + try: + assert h_tpm_v2.routing_args.ttl == 240 + finally: + await h_tpm_v2.cleanup()