Coverage for agentos/tests/test_cost_types.py: 0%

41 statements  

« prev     ^ index     » next       coverage.py v7.14.3, created at 2026-07-06 21:19 +0800

1"""Tests for agentos/cost.py — re-exported cost data types.""" 

2 

3from agentos.cost import CostEstimate, ModelFamily, TokenCount, TokenCounter 

4 

5 

6class TestModelFamily: 

7 def test_all_families_reachable(self): 

8 assert ModelFamily.GPT4 is not None 

9 assert ModelFamily.GPT4O is not None 

10 assert ModelFamily.GPT35 is not None 

11 

12 def test_all_families_exist(self): 

13 assert ModelFamily.GPT4.value == "gpt-4" 

14 assert ModelFamily.GPT4O.value == "gpt-4o" 

15 assert ModelFamily.UNKNOWN.value == "unknown" 

16 

17 

18class TestTokenCount: 

19 def test_defaults(self): 

20 tc = TokenCount() 

21 assert tc.prompt_tokens == 0 

22 assert tc.completion_tokens == 0 

23 assert tc.total_tokens == 0 

24 assert tc.model == "" 

25 

26 def test_custom_values(self): 

27 tc = TokenCount(prompt_tokens=100, completion_tokens=50, total_tokens=150, model="gpt-4o") 

28 assert tc.prompt_tokens == 100 

29 assert tc.completion_tokens == 50 

30 assert tc.total_tokens == 150 

31 assert tc.model == "gpt-4o" 

32 

33 def test_importable_from_cost_module(self): 

34 assert TokenCount is not None 

35 

36 

37class TestCostEstimate: 

38 def test_default_total_is_zero(self): 

39 ce = CostEstimate() 

40 assert ce.total_cost == 0.0 

41 assert ce.prompt_cost == 0.0 

42 assert ce.completion_cost == 0.0 

43 assert ce.currency == "USD" 

44 

45 def test_custom_total(self): 

46 ce = CostEstimate(total_cost=0.0042) 

47 assert ce.total_cost == 0.0042 

48 

49 

50class TestCostModuleTokenCounter: 

51 def test_token_counter_exists(self): 

52 assert TokenCounter is not None 

53 

54 def test_token_counter_instantiable(self): 

55 tc = TokenCounter() 

56 assert isinstance(tc, TokenCounter)