fix by review

This commit is contained in:
moririn2528
2023-09-12 16:00:46 +09:00
parent b4a4c2dae0
commit 5fcc64cff3
5 changed files with 34 additions and 68 deletions
+8 -6
View File
@@ -3,16 +3,18 @@ from __future__ import annotations
from unittest import TestCase
import optuna
from optuna_dashboard._preference_setting import _SYSTEM_ATTR_FEEDBACK_ARTIFACT_KEY
from optuna_dashboard._preference_setting import _SYSTEM_ATTR_FEEDBACK_COMPONENT_TYPE
from optuna_dashboard._preference_setting import register_output_component
from optuna_dashboard._preference_setting import _SYSTEM_ATTR_FEEDBACK_COMPONENT
from optuna_dashboard._preference_setting import register_preference_feedback_component_type
from optuna_dashboard.preferential._study import PreferentialStudy
class FeedbackSettingTestCase(TestCase):
def test_widget_to_dict_from_dict(self) -> None:
study = PreferentialStudy(optuna.create_study())
register_output_component(study, "Artifact", "image_key")
register_preference_feedback_component_type(study, "Artifact", "image_key")
system_attrs = study._study.system_attrs
assert system_attrs.get(_SYSTEM_ATTR_FEEDBACK_COMPONENT_TYPE, "") == "Artifact"
assert system_attrs.get(_SYSTEM_ATTR_FEEDBACK_ARTIFACT_KEY, "") == "image_key"
feedback_type = system_attrs.get(_SYSTEM_ATTR_FEEDBACK_COMPONENT, {})
assert "type" in feedback_type
assert feedback_type["type"] == "Artifact"
assert "artifact_key" in feedback_type
assert feedback_type["artifact_key"] == "image_key"