24
24
from google .adk .evaluation .eval_case import Invocation
25
25
from google .adk .evaluation .eval_set import EvalSet
26
26
from google .adk .evaluation .local_eval_sets_manager import _EVAL_SET_FILE_EXTENSION
27
- from google .adk .evaluation .local_eval_sets_manager import convert_eval_set_to_pydanctic_schema
27
+ from google .adk .evaluation .local_eval_sets_manager import convert_eval_set_to_pydantic_schema
28
28
from google .adk .evaluation .local_eval_sets_manager import load_eval_set_from_file
29
29
from google .adk .evaluation .local_eval_sets_manager import LocalEvalSetsManager
30
30
from google .genai import types as genai_types
31
31
from pydantic import ValidationError
32
32
import pytest
33
33
34
34
35
- class TestConvertEvalSetToPydancticSchema :
36
- """Tests convert_eval_set_to_pydanctic_schema method."""
35
+ class TestConvertEvalSetToPydanticSchema :
36
+ """Tests convert_eval_set_to_pydantic_schema method."""
37
37
38
- def test_convert_eval_set_to_pydanctic_schema_complete (self ):
38
+ def test_convert_eval_set_to_pydantic_schema_complete (self ):
39
39
eval_set_id = "test_eval_set"
40
40
eval_set_in_json_format = [{
41
41
"name" : "roll_17_sided_dice_twice" ,
@@ -71,7 +71,7 @@ def test_convert_eval_set_to_pydanctic_schema_complete(self):
71
71
},
72
72
}]
73
73
74
- eval_set = convert_eval_set_to_pydanctic_schema (
74
+ eval_set = convert_eval_set_to_pydantic_schema (
75
75
eval_set_id , eval_set_in_json_format
76
76
)
77
77
@@ -93,14 +93,14 @@ def test_convert_eval_set_to_pydanctic_schema_complete(self):
93
93
== 1
94
94
)
95
95
96
- def test_convert_eval_set_to_pydanctic_schema_minimal (self ):
96
+ def test_convert_eval_set_to_pydantic_schema_minimal (self ):
97
97
eval_set_id = "test_eval_set"
98
98
eval_set_in_json_format = [{
99
99
"name" : "minimal_case" ,
100
100
"data" : [{"query" : "Hello" , "reference" : "World" }],
101
101
}]
102
102
103
- eval_set = convert_eval_set_to_pydanctic_schema (
103
+ eval_set = convert_eval_set_to_pydantic_schema (
104
104
eval_set_id , eval_set_in_json_format
105
105
)
106
106
@@ -117,7 +117,7 @@ def test_convert_eval_set_to_pydanctic_schema_minimal(self):
117
117
== "World"
118
118
)
119
119
120
- def test_convert_eval_set_to_pydanctic_schema_empty_tool_use_and_intermediate_responses (
120
+ def test_convert_eval_set_to_pydantic_schema_empty_tool_use_and_intermediate_responses (
121
121
self ,
122
122
):
123
123
eval_set_id = "test_eval_set"
@@ -131,7 +131,7 @@ def test_convert_eval_set_to_pydanctic_schema_empty_tool_use_and_intermediate_re
131
131
}],
132
132
}]
133
133
134
- eval_set = convert_eval_set_to_pydanctic_schema (
134
+ eval_set = convert_eval_set_to_pydantic_schema (
135
135
eval_set_id , eval_set_in_json_format
136
136
)
137
137
@@ -150,22 +150,22 @@ def test_convert_eval_set_to_pydanctic_schema_empty_tool_use_and_intermediate_re
150
150
== 0
151
151
)
152
152
153
- def test_convert_eval_set_to_pydanctic_schema_empty_initial_session (self ):
153
+ def test_convert_eval_set_to_pydantic_schema_empty_initial_session (self ):
154
154
eval_set_id = "test_eval_set"
155
155
eval_set_in_json_format = [{
156
156
"name" : "empty_session" ,
157
157
"data" : [{"query" : "Test" , "reference" : "Test Ref" }],
158
158
"initial_session" : {},
159
159
}]
160
160
161
- eval_set = convert_eval_set_to_pydanctic_schema (
161
+ eval_set = convert_eval_set_to_pydantic_schema (
162
162
eval_set_id , eval_set_in_json_format
163
163
)
164
164
165
165
assert eval_set .eval_set_id == eval_set_id
166
166
assert eval_set .eval_cases [0 ].session_input is None
167
167
168
- def test_convert_eval_set_to_pydanctic_schema_invalid_data (self ):
168
+ def test_convert_eval_set_to_pydantic_schema_invalid_data (self ):
169
169
# This test implicitly checks for potential validation errors during Pydantic
170
170
# object creation
171
171
eval_set_id = "test_eval_set"
@@ -190,7 +190,7 @@ def test_convert_eval_set_to_pydanctic_schema_invalid_data(self):
190
190
}]
191
191
192
192
with pytest .raises (ValidationError ):
193
- convert_eval_set_to_pydanctic_schema (eval_set_id , eval_set_in_json_format )
193
+ convert_eval_set_to_pydantic_schema (eval_set_id , eval_set_in_json_format )
194
194
195
195
196
196
class TestLoadEvalSetFromFile :
@@ -300,14 +300,14 @@ def test_load_eval_set_from_file_invalid_json(self, tmp_path):
300
300
def test_load_eval_set_from_file_invalid_data (self , tmp_path , mocker ):
301
301
# Create a dummy file with invalid data that fails both Pydantic validation
302
302
# and the old format conversion. We mock the
303
- # convert_eval_set_to_pydanctic_schema function to raise a ValueError
303
+ # convert_eval_set_to_pydantic_schema function to raise a ValueError
304
304
# so that we can assert that the exception is raised.
305
305
file_path = tmp_path / "invalid_data.json"
306
306
with open (file_path , "w" , encoding = "utf-8" ) as f :
307
307
f .write ('{"invalid": "data"}' )
308
308
309
309
mocker .patch (
310
- "google.adk.evaluation.local_eval_sets_manager.convert_eval_set_to_pydanctic_schema " ,
310
+ "google.adk.evaluation.local_eval_sets_manager.convert_eval_set_to_pydantic_schema " ,
311
311
side_effect = ValueError (),
312
312
)
313
313
0 commit comments