11import pytest
2- from traceloop .sdk .evaluator .evaluator import validate_task_output
2+ from traceloop .sdk .evaluator .evaluator import validate_and_normalize_task_output
33from traceloop .sdk .evaluator .config import EvaluatorDetails
44
55
@@ -12,7 +12,7 @@ def test_validate_task_output_with_no_evaluators(self):
1212 evaluators = []
1313
1414 # Should not raise any exception
15- validate_task_output (task_output , evaluators )
15+ validate_and_normalize_task_output (task_output , evaluators )
1616
1717 def test_validate_task_output_with_evaluators_no_required_fields (self ):
1818 """Test that validation passes when evaluators have no required fields"""
@@ -23,7 +23,7 @@ def test_validate_task_output_with_evaluators_no_required_fields(self):
2323 ]
2424
2525 # Should not raise any exception
26- validate_task_output (task_output , evaluators )
26+ validate_and_normalize_task_output (task_output , evaluators )
2727
2828 def test_validate_task_output_with_valid_output (self ):
2929 """Test that validation passes when all required fields are present"""
@@ -37,7 +37,7 @@ def test_validate_task_output_with_valid_output(self):
3737 ]
3838
3939 # Should not raise any exception
40- validate_task_output (task_output , evaluators )
40+ validate_and_normalize_task_output (task_output , evaluators )
4141
4242 def test_validate_task_output_missing_single_field (self ):
4343 """Test that validation fails when a single required field is missing"""
@@ -47,7 +47,7 @@ def test_validate_task_output_missing_single_field(self):
4747 ]
4848
4949 with pytest .raises (ValueError ) as exc_info :
50- validate_task_output (task_output , evaluators )
50+ validate_and_normalize_task_output (task_output , evaluators )
5151
5252 error_message = str (exc_info .value )
5353 assert "Task output missing required fields for evaluators:" in error_message
@@ -70,7 +70,7 @@ def test_validate_task_output_missing_multiple_fields_single_evaluator(self):
7070 ]
7171
7272 with pytest .raises (ValueError ) as exc_info :
73- validate_task_output (task_output , evaluators )
73+ validate_and_normalize_task_output (task_output , evaluators )
7474
7575 error_message = str (exc_info .value )
7676 assert "relevance-checker requires:" in error_message
@@ -91,7 +91,7 @@ def test_validate_task_output_missing_fields_multiple_evaluators(self):
9191 ]
9292
9393 with pytest .raises (ValueError ) as exc_info :
94- validate_task_output (task_output , evaluators )
94+ validate_and_normalize_task_output (task_output , evaluators )
9595
9696 error_message = str (exc_info .value )
9797 assert "pii-detector requires:" in error_message
@@ -113,7 +113,7 @@ def test_validate_task_output_partial_match(self):
113113 ]
114114
115115 with pytest .raises (ValueError ) as exc_info :
116- validate_task_output (task_output , evaluators )
116+ validate_and_normalize_task_output (task_output , evaluators )
117117
118118 error_message = str (exc_info .value )
119119 # Should only mention the failing evaluator
@@ -128,7 +128,7 @@ def test_validate_task_output_empty_task_output(self):
128128 ]
129129
130130 with pytest .raises (ValueError ) as exc_info :
131- validate_task_output (task_output , evaluators )
131+ validate_and_normalize_task_output (task_output , evaluators )
132132
133133 error_message = str (exc_info .value )
134134 assert "Task output contains: []" in error_message
@@ -147,7 +147,7 @@ def test_validate_task_output_with_extra_fields(self):
147147 ]
148148
149149 # Should not raise any exception - extra fields are allowed
150- validate_task_output (task_output , evaluators )
150+ validate_and_normalize_task_output (task_output , evaluators )
151151
152152 def test_validate_task_output_case_sensitive_field_names (self ):
153153 """Test that field name matching is case-sensitive"""
@@ -157,7 +157,7 @@ def test_validate_task_output_case_sensitive_field_names(self):
157157 ]
158158
159159 with pytest .raises (ValueError ) as exc_info :
160- validate_task_output (task_output , evaluators )
160+ validate_and_normalize_task_output (task_output , evaluators )
161161
162162 error_message = str (exc_info .value )
163163 assert "pii-detector requires:" in error_message
@@ -177,7 +177,7 @@ def test_validate_task_output_with_evaluator_config(self):
177177 ]
178178
179179 # Should not raise any exception - config shouldn't affect validation
180- validate_task_output (task_output , evaluators )
180+ validate_and_normalize_task_output (task_output , evaluators )
181181
182182 def test_validate_task_output_mixed_evaluators (self ):
183183 """Test validation with a mix of evaluators with and without required fields"""
@@ -193,7 +193,7 @@ def test_validate_task_output_mixed_evaluators(self):
193193 ]
194194
195195 with pytest .raises (ValueError ) as exc_info :
196- validate_task_output (task_output , evaluators )
196+ validate_and_normalize_task_output (task_output , evaluators )
197197
198198 error_message = str (exc_info .value )
199199 # Should only mention failing evaluator
@@ -215,7 +215,7 @@ def test_validate_task_output_duplicate_required_fields(self):
215215 ]
216216
217217 with pytest .raises (ValueError ) as exc_info :
218- validate_task_output (task_output , evaluators )
218+ validate_and_normalize_task_output (task_output , evaluators )
219219
220220 error_message = str (exc_info .value )
221221 assert "pii-detector requires:" in error_message
0 commit comments