fix: unit test should not call private function (#1494)

* fix: unit test should not call private function

* fix test

* restore config
This commit is contained in:
olgavrou
2024-01-31 23:31:45 +02:00
committed by GitHub
parent a2d4b47503
commit 03f165ce81

View File

@@ -138,12 +138,6 @@ def test_usage_summary():
# check print
client.print_usage_summary()
# check update
client._update_usage_summary(response, use_cache=True)
assert (
client.total_usage_summary["total_cost"] == response.cost * 2
), "total_cost should be equal to response.cost * 2"
# check clear
client.clear_usage_summary()
assert client.actual_usage_summary is None, "actual_usage_summary should be None"
@@ -152,8 +146,16 @@ def test_usage_summary():
# actual usage and all usage should be different
response = client.create(prompt="1+3=", model=model, cache_seed=42)
assert client.total_usage_summary["total_cost"] > 0, "total_cost should be greater than 0"
client.clear_usage_summary()
response = client.create(prompt="1+3=", model=model, cache_seed=42)
assert client.actual_usage_summary is None, "No actual cost should be recorded"
# check update
response = client.create(prompt="1+3=", model=model, cache_seed=42)
assert (
client.total_usage_summary["total_cost"] == response.cost * 2
), "total_cost should be equal to response.cost * 2"
@pytest.mark.skipif(skip, reason="openai>=1 not installed")
def test_legacy_cache():