from __future__ import annotations from decimal import Decimal from v1.agent_chat.service import aggregate_session_cost def test_aggregate_session_cost_sums_non_negative_values() -> None: total = aggregate_session_cost([Decimal("0.010000"), Decimal("0.002500")]) assert total == Decimal("0.012500") def test_aggregate_session_cost_rejects_negative_value() -> None: try: aggregate_session_cost([Decimal("-0.010000")]) raised = False except ValueError: raised = True assert raised is True