Interface change for set_study_directions

This commit is contained in:
gen740
2022-11-28 17:46:58 +09:00
parent 7f279b3a5a
commit c30fe8234f
2 changed files with 13 additions and 14 deletions
+6 -5
View File
@@ -2,6 +2,7 @@ import json
from unittest import TestCase
import optuna
from optuna.study import StudyDirection
from optuna import get_all_study_summaries
from optuna_dashboard._app import create_app
@@ -16,8 +17,8 @@ def objective(trial: optuna.trial.Trial) -> float:
class APITestCase(TestCase):
def test_get_study_summaries(self) -> None:
storage = optuna.storages.InMemoryStorage()
storage.create_new_study("foo1")
storage.create_new_study("foo2")
storage.create_new_study(study_name="foo1", directions=[StudyDirection.MINIMIZE])
storage.create_new_study(study_name="foo2", directions=[StudyDirection.MINIMIZE])
app = create_app(storage)
status, _, body = send_request(
@@ -126,7 +127,7 @@ class APITestCase(TestCase):
def test_create_study_duplicated(self) -> None:
storage = optuna.storages.InMemoryStorage()
storage.create_new_study("foo")
storage.create_new_study(study_name="foo", directions=[StudyDirection.MINIMIZE])
self.assertEqual(len(get_all_study_summaries(storage)), 1)
app = create_app(storage)
@@ -146,8 +147,8 @@ class APITestCase(TestCase):
def test_delete_study(self) -> None:
storage = optuna.storages.InMemoryStorage()
storage.create_new_study("foo1")
storage.create_new_study("foo2")
storage.create_new_study(study_name="foo1", directions=[StudyDirection.MINIMIZE])
storage.create_new_study(study_name="foo2", directions=[StudyDirection.MINIMIZE])
self.assertEqual(len(get_all_study_summaries(storage)), 2)
app = create_app(storage)