Add get_note() Python API

This commit is contained in:
c-bata
2023-03-29 17:47:20 +09:00
parent 957a8fd87d
commit 6892f31781
3 changed files with 42 additions and 2 deletions
+9
View File
@@ -5,6 +5,7 @@ from unittest.mock import patch
import optuna
from optuna_dashboard import _note as note
from optuna_dashboard import get_note
from optuna_dashboard import save_note
@@ -29,6 +30,10 @@ class NoteTestCase(TestCase):
with self.subTest(body):
save_note(study, body)
system_attrs = study._storage.get_study_system_attrs(study._study_id)
actual = get_note(study)
assert actual == body
note_dict = note.get_note_from_system_attrs(system_attrs, None)
assert note_dict["body"] == body
assert note_dict["version"] == expected_ver
@@ -41,6 +46,10 @@ class NoteTestCase(TestCase):
with self.subTest(body):
save_note(trial, body)
system_attrs = study._storage.get_study_system_attrs(study._study_id)
actual = get_note(trial)
assert actual == body
note_dict = note.get_note_from_system_attrs(system_attrs, trial._trial_id)
assert note_dict["body"] == body
assert note_dict["version"] == expected_ver