From 383f6d45d8c258f1f562808cea86819f3651e276 Mon Sep 17 00:00:00 2001 From: LeeJuOh Date: Sun, 22 Feb 2026 16:04:06 +0900 Subject: [PATCH] test(budget): add test for timezone fallback warning log --- .../litellm_core_utils/test_duration_parser.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_litellm/litellm_core_utils/test_duration_parser.py b/tests/test_litellm/litellm_core_utils/test_duration_parser.py index 52316d4d97d..27b47d833db 100644 --- a/tests/test_litellm/litellm_core_utils/test_duration_parser.py +++ b/tests/test_litellm/litellm_core_utils/test_duration_parser.py @@ -1,5 +1,6 @@ import unittest from datetime import datetime, timezone +from unittest.mock import patch from zoneinfo import ZoneInfo from litellm.litellm_core_utils.duration_parser import get_next_standardized_reset_time @@ -184,5 +185,13 @@ class TestStandardizedResetTime(unittest.TestCase): self.assertEqual(result, expected) + def test_invalid_timezone_logs_warning(self): + """Test that an invalid timezone logs a warning when falling back to UTC.""" + base_time = datetime(2023, 5, 15, 14, 0, 0, tzinfo=timezone.utc) + with patch("litellm.litellm_core_utils.duration_parser.verbose_logger") as mock_logger: + get_next_standardized_reset_time("1d", base_time, "NonExistentTimeZone") + mock_logger.warning.assert_called_once() + + if __name__ == "__main__": unittest.main()