mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Interface change for set_study_directions
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user