mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-27 01:22:18 +00:00
test(integration): require a zero cost header to read zero when the case bills nothing
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
8137d878a0
commit
23f5df05f2
1 changed files with 5 additions and 1 deletions
|
|
@ -92,7 +92,11 @@ def test_case_bills_expected_cost(gateway: Gateway, case: CostTrackingTestCase)
|
|||
assert isinstance(expected, ExactExpected)
|
||||
if case.response.content_type == "application/json":
|
||||
header: Final = cast(str | None, response.headers.get("x-litellm-response-cost"))
|
||||
assert expected.spend == 0 or (header is not None and approx_equal(float(header), expected.spend)), (
|
||||
assert (
|
||||
(header is None or approx_equal(float(header), 0.0))
|
||||
if expected.spend == 0
|
||||
else (header is not None and approx_equal(float(header), expected.spend))
|
||||
), (
|
||||
f"{case.name}: x-litellm-response-cost {header} != expected {expected.spend}"
|
||||
)
|
||||
assert row.spend is not None and approx_equal(row.spend, expected.spend), (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue