mirror of
https://github.com/encounter/adk-python.git
synced 2026-07-09 18:19:28 -07:00
fix: Update create_eval_set API to return the created EvalSet and it route
PiperOrigin-RevId: 797974571
This commit is contained in:
committed by
Copybara-Service
parent
157f73181d
commit
f660180854
@@ -370,16 +370,21 @@ class TestLocalEvalSetsManager:
|
||||
eval_set_id + _EVAL_SET_FILE_EXTENSION,
|
||||
)
|
||||
|
||||
local_eval_sets_manager.create_eval_set(app_name, eval_set_id)
|
||||
created_eval_set = local_eval_sets_manager.create_eval_set(
|
||||
app_name, eval_set_id
|
||||
)
|
||||
|
||||
expected_eval_set = EvalSet(
|
||||
eval_set_id=eval_set_id,
|
||||
name=eval_set_id,
|
||||
eval_cases=[],
|
||||
creation_timestamp=mocked_time,
|
||||
)
|
||||
mock_write_eval_set_to_path.assert_called_once_with(
|
||||
eval_set_file_path,
|
||||
EvalSet(
|
||||
eval_set_id=eval_set_id,
|
||||
name=eval_set_id,
|
||||
eval_cases=[],
|
||||
creation_timestamp=mocked_time,
|
||||
),
|
||||
expected_eval_set,
|
||||
)
|
||||
assert created_eval_set == expected_eval_set
|
||||
|
||||
def test_local_eval_sets_manager_create_eval_set_invalid_id(
|
||||
self, local_eval_sets_manager
|
||||
@@ -390,6 +395,19 @@ class TestLocalEvalSetsManager:
|
||||
with pytest.raises(ValueError, match="Invalid Eval Set Id"):
|
||||
local_eval_sets_manager.create_eval_set(app_name, eval_set_id)
|
||||
|
||||
def test_local_eval_sets_manager_create_eval_set_already_exists(
|
||||
self, local_eval_sets_manager, mocker
|
||||
):
|
||||
app_name = "test_app"
|
||||
eval_set_id = "existing_eval_set_id"
|
||||
mocker.patch("os.path.exists", return_value=True)
|
||||
|
||||
with pytest.raises(
|
||||
ValueError,
|
||||
match="EvalSet existing_eval_set_id already exists for app test_app.",
|
||||
):
|
||||
local_eval_sets_manager.create_eval_set(app_name, eval_set_id)
|
||||
|
||||
def test_local_eval_sets_manager_list_eval_sets_success(
|
||||
self, local_eval_sets_manager, mocker
|
||||
):
|
||||
|
||||
Reference in New Issue
Block a user