mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-03 02:22:24 +00:00
test: exercise relative week semantics with non-Monday base dates + add docstring
Signed-off-by: FugoP <264910004+AgentGymLeader@users.noreply.github.com>
This commit is contained in:
parent
13278b4a68
commit
dbbc2c9ba8
1 changed files with 8 additions and 2 deletions
|
|
@ -35,13 +35,19 @@ class TestStandardizedResetTime(unittest.TestCase):
|
|||
self.assertEqual(custom_day_result, custom_day_expected)
|
||||
|
||||
def test_week_based_resets(self):
|
||||
"""Test week-based reset durations (1w, 2w).
|
||||
1w snaps to the next Monday at midnight (same as 7d).
|
||||
2w advances exactly 14 days from the current date at midnight.
|
||||
"""
|
||||
# 1w from a Wednesday -> next Monday (5 days away, not 7)
|
||||
wednesday = datetime(2023, 5, 17, 15, 45, 0, tzinfo=timezone.utc)
|
||||
weekly_expected = datetime(2023, 5, 22, 0, 0, 0, tzinfo=timezone.utc)
|
||||
weekly_result = get_next_standardized_reset_time("1w", wednesday, "UTC")
|
||||
self.assertEqual(weekly_result, weekly_expected)
|
||||
|
||||
base_time = datetime(2023, 5, 15, 10, 30, 0, tzinfo=timezone.utc)
|
||||
two_week_expected = datetime(2023, 5, 29, 0, 0, 0, tzinfo=timezone.utc)
|
||||
# 2w from a Wednesday -> exactly 14 days out (lands on a Wednesday, not Monday)
|
||||
base_time = datetime(2023, 5, 17, 10, 30, 0, tzinfo=timezone.utc)
|
||||
two_week_expected = datetime(2023, 5, 31, 0, 0, 0, tzinfo=timezone.utc)
|
||||
two_week_result = get_next_standardized_reset_time("2w", base_time, "UTC")
|
||||
self.assertEqual(two_week_result, two_week_expected)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue