diff options
Diffstat (limited to 'test_llamachat.py')
| -rwxr-xr-x | test_llamachat.py | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test_llamachat.py b/test_llamachat.py index b561b66..18b6f0a 100755 --- a/test_llamachat.py +++ b/test_llamachat.py @@ -2025,6 +2025,36 @@ def test_model_dialog_values(): print("ok model dialog value conversion") +def test_cost_label_text(): + """The label distinguishes free, unpriced, and a real figure.""" + from llamachat import ui + + # A local model costs nothing, so the label says nothing. + assert ui.cost_text(spent=0.0, projected=0.0, billable=False, priced=False) == "" + + # A cloud model whose price was never entered: ? rather than blank, so + # it cannot be mistaken for free. + assert ui.cost_text( + spent=0.0, projected=0.0, billable=True, priced=False + ) == "?" + + # Spent so far, with nothing composed yet. + assert ui.cost_text( + spent=0.043, projected=0.0, billable=True, priced=True + ) == "$0.043" + + # Spent plus what sending the draft would add, kept visually separate. + assert ui.cost_text( + spent=0.043, projected=0.011, billable=True, priced=True + ) == "$0.043 +$0.011" + + # A fresh conversation on a priced model still shows the projection. + assert ui.cost_text( + spent=0.0, projected=0.002, billable=True, priced=True + ) == "$0.000 +$0.002" + print("ok cost label text") + + class _FakeResponse: """Enough of an http.client response for urlopen's context manager.""" @@ -2788,6 +2818,7 @@ if __name__ == "__main__": test_client_auth_header() test_multi_client() test_model_dialog_values() + test_cost_label_text() test_search_tool_schema() test_search_results_sanitising() test_tool_call_accumulation() |
