@@ -14,6 +14,7 @@ from agent.policy.deal_followup import (
|
||||
leader_matches,
|
||||
next_followup_at,
|
||||
shift_workdays,
|
||||
workday_elapsed_hours,
|
||||
)
|
||||
|
||||
|
||||
@@ -37,6 +38,22 @@ class TestWorkdays(unittest.TestCase):
|
||||
self.assertEqual(when.tzinfo, SHANGHAI)
|
||||
self.assertEqual(when.date(), date(2026, 9, 24))
|
||||
|
||||
def test_skip_weekend_keep_weekday_night(self) -> None:
|
||||
start = datetime(2026, 9, 18, 17, 0, tzinfo=SHANGHAI) # 周五
|
||||
now = datetime(2026, 9, 21, 17, 0, tzinfo=SHANGHAI) # 周一
|
||||
# 周五 17–24 = 7h,周末不算,周一 0–17 = 17h
|
||||
self.assertAlmostEqual(workday_elapsed_hours(start, now), 24.0, places=4)
|
||||
|
||||
def test_rest_day_start_counts_from_next_workday(self) -> None:
|
||||
start = datetime(2026, 9, 19, 10, 0, tzinfo=SHANGHAI) # 周六
|
||||
now = datetime(2026, 9, 21, 10, 0, tzinfo=SHANGHAI) # 周一
|
||||
self.assertAlmostEqual(workday_elapsed_hours(start, now), 10.0, places=4)
|
||||
|
||||
def test_fractional_quarter_hour(self) -> None:
|
||||
start = datetime(2026, 9, 18, 9, 0, tzinfo=SHANGHAI)
|
||||
now = datetime(2026, 9, 18, 9, 15, tzinfo=SHANGHAI)
|
||||
self.assertAlmostEqual(workday_elapsed_hours(start, now), 0.25, places=4)
|
||||
|
||||
|
||||
class TestAirRouteKeys(unittest.TestCase):
|
||||
def test_pair_and_dest(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user