mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-20 05:04:24 +00:00
test: add unit tests for unlimited budget duration
This commit is contained in:
parent
0cc4fef426
commit
9774245f40
2 changed files with 13 additions and 1 deletions
|
|
@ -363,4 +363,4 @@ def _handle_month_reset(current_time: datetime, base_midnight: datetime, value:
|
|||
second=0,
|
||||
microsecond=0,
|
||||
tzinfo=current_time.tzinfo,
|
||||
)
|
||||
)
|
||||
|
|
|
|||
12
tests/test_duration_parser.py
Normal file
12
tests/test_duration_parser.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import pytest
|
||||
from litellm.litellm_core_utils.duration_parser import duration_in_seconds
|
||||
|
||||
def test_unlimited_budget_duration():
|
||||
# 1. Test that the bug is fixed (Empty/None values safely return None)
|
||||
assert duration_in_seconds("None") is None
|
||||
assert duration_in_seconds("null") is None
|
||||
assert duration_in_seconds("") is None
|
||||
assert duration_in_seconds(None) is None
|
||||
|
||||
# 2. Test that normal math still works (30 days = 2,592,000 seconds)
|
||||
assert duration_in_seconds("30d") == 2592000
|
||||
Loading…
Add table
Reference in a new issue