@@ -29,22 +29,22 @@ def test_context_percentages_with_context_window_max(self):
2929 )
3030 )
3131
32- assert total_percentage is not None , (
33- " total_percentage should not be None when context_window_max is provided"
34- )
35- assert until_summarization_percentage is not None , (
36- " until_summarization_percentage should not be None when context_window_max is provided"
37- )
32+ assert (
33+ total_percentage is not None
34+ ), "total_percentage should not be None when context_window_max is provided"
35+ assert (
36+ until_summarization_percentage is not None
37+ ), "until_summarization_percentage should not be None when context_window_max is provided"
3838 assert isinstance (total_percentage , float ), "total_percentage should be a float"
39- assert isinstance (until_summarization_percentage , float ), (
40- " until_summarization_percentage should be a float"
41- )
42- assert 0 <= total_percentage <= 100 , (
43- "total_percentage should be between 0 and 100"
44- )
45- assert 0 <= until_summarization_percentage <= 100 , (
46- "until_summarization_percentage should be between 0 and 100"
47- )
39+ assert isinstance (
40+ until_summarization_percentage , float
41+ ), "until_summarization_percentage should be a float"
42+ assert (
43+ 0 <= total_percentage <= 100
44+ ), "total_percentage should be between 0 and 100"
45+ assert (
46+ 0 <= until_summarization_percentage <= 100
47+ ), "until_summarization_percentage should be between 0 and 100"
4848
4949 def test_context_percentages_with_model_name (self ):
5050 """Test that context percentages are calculated when model_name is provided"""
@@ -59,16 +59,16 @@ def test_context_percentages_with_model_name(self):
5959 )
6060 )
6161
62- assert total_percentage is not None , (
63- " total_percentage should not be None when model_name is provided"
64- )
65- assert until_summarization_percentage is not None , (
66- " until_summarization_percentage should not be None when model_name is provided"
67- )
62+ assert (
63+ total_percentage is not None
64+ ), "total_percentage should not be None when model_name is provided"
65+ assert (
66+ until_summarization_percentage is not None
67+ ), "until_summarization_percentage should not be None when model_name is provided"
6868 assert isinstance (total_percentage , float ), "total_percentage should be a float"
69- assert isinstance (until_summarization_percentage , float ), (
70- " until_summarization_percentage should be a float"
71- )
69+ assert isinstance (
70+ until_summarization_percentage , float
71+ ), "until_summarization_percentage should be a float"
7272
7373 def test_context_percentages_without_model_info (self ):
7474 """Test that context percentages return None when no model info is provided"""
@@ -83,12 +83,12 @@ def test_context_percentages_without_model_info(self):
8383 )
8484 )
8585
86- assert total_percentage is None , (
87- " total_percentage should be None when no model info is provided"
88- )
89- assert until_summarization_percentage is None , (
90- " until_summarization_percentage should be None when no model info is provided"
91- )
86+ assert (
87+ total_percentage is None
88+ ), "total_percentage should be None when no model info is provided"
89+ assert (
90+ until_summarization_percentage is None
91+ ), "until_summarization_percentage should be None when no model info is provided"
9292
9393 def test_context_percentages_with_empty_messages (self ):
9494 """Test context percentages with empty messages list but model info provided"""
@@ -101,12 +101,12 @@ def test_context_percentages_with_empty_messages(self):
101101 )
102102
103103 # CORRECTED: Should return 0.0 when model info is provided, even with empty messages
104- assert total_percentage == 0.0 , (
105- " total_percentage should be 0.0 for empty messages when model info provided"
106- )
107- assert until_summarization_percentage == 0.0 , (
108- " until_summarization_percentage should be 0.0 for empty messages when model info provided"
109- )
104+ assert (
105+ total_percentage == 0.0
106+ ), "total_percentage should be 0.0 for empty messages when model info provided"
107+ assert (
108+ until_summarization_percentage == 0.0
109+ ), "until_summarization_percentage should be 0.0 for empty messages when model info provided"
110110
111111 def test_context_percentages_precedence (self ):
112112 """Test that context_window_max takes precedence over model_name"""
@@ -131,9 +131,9 @@ def test_context_percentages_precedence(self):
131131 )
132132
133133 # Results should be the same, proving context_window_max takes precedence
134- assert total_percentage_both == total_percentage_max_only , (
135- "context_window_max should take precedence over model_name"
136- )
134+ assert (
135+ total_percentage_both == total_percentage_max_only
136+ ), "context_window_max should take precedence over model_name"
137137 assert (
138138 until_summarization_percentage_both
139139 == until_summarization_percentage_max_only
@@ -163,9 +163,9 @@ def test_context_percentages_high_token_usage(self):
163163 assert until_summarization_percentage is not None
164164 # Should be capped at 100%
165165 assert total_percentage <= 100.0 , "total_percentage should be capped at 100%"
166- assert until_summarization_percentage <= 100.0 , (
167- " until_summarization_percentage should be capped at 100%"
168- )
166+ assert (
167+ until_summarization_percentage <= 100.0
168+ ), "until_summarization_percentage should be capped at 100%"
169169
170170 def test_context_percentages_zero_context_window_regression (self ):
171171 """
@@ -185,9 +185,9 @@ def test_context_percentages_zero_context_window_regression(self):
185185
186186 # Should return None for invalid context window
187187 assert total_percentage is None , "Should return None for zero context window"
188- assert until_summarization_percentage is None , (
189- "Should return None for zero context window"
190- )
188+ assert (
189+ until_summarization_percentage is None
190+ ), "Should return None for zero context window"
191191
192192 # Test with negative context window
193193 total_percentage , until_summarization_percentage = (
@@ -197,12 +197,12 @@ def test_context_percentages_zero_context_window_regression(self):
197197 )
198198
199199 # Should return None for invalid context window
200- assert total_percentage is None , (
201- "Should return None for negative context window"
202- )
203- assert until_summarization_percentage is None , (
204- "Should return None for negative context window"
205- )
200+ assert (
201+ total_percentage is None
202+ ), "Should return None for negative context window"
203+ assert (
204+ until_summarization_percentage is None
205+ ), "Should return None for negative context window"
206206
207207 def test_context_percentages_very_small_context_window_regression (self ):
208208 """
@@ -224,17 +224,17 @@ def test_context_percentages_very_small_context_window_regression(self):
224224 )
225225
226226 # Should handle this gracefully without division by zero
227- assert total_percentage is not None , (
228- "Should handle small context window without error"
229- )
230- assert until_summarization_percentage is not None , (
231- "Should handle small context window without error"
232- )
227+ assert (
228+ total_percentage is not None
229+ ), "Should handle small context window without error"
230+ assert (
231+ until_summarization_percentage is not None
232+ ), "Should handle small context window without error"
233233 assert isinstance (total_percentage , float ), "Should return valid float"
234- assert isinstance (until_summarization_percentage , float ), (
235- "Should return valid float"
236- )
234+ assert isinstance (
235+ until_summarization_percentage , float
236+ ), "Should return valid float"
237237 # until_summarization_percentage should be 100% when threshold is 0
238- assert until_summarization_percentage == 100.0 , (
239- "Should return 100% when token threshold is 0"
240- )
238+ assert (
239+ until_summarization_percentage == 100.0
240+ ), "Should return 100% when token threshold is 0"
0 commit comments