mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
test(budget): add test for timezone fallback warning log
This commit is contained in:
parent
e9ffe01da1
commit
383f6d45d8
1 changed files with 9 additions and 0 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue