mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Fix broken tests
This commit is contained in:
@@ -1,25 +1,13 @@
|
||||
import json
|
||||
from typing import List
|
||||
from unittest import TestCase
|
||||
|
||||
import optuna
|
||||
from optuna.storages import BaseStorage
|
||||
from optuna.study import StudySummary
|
||||
from optuna.version import __version__ as optuna_ver
|
||||
from optuna import get_all_study_summaries
|
||||
from optuna_dashboard._app import create_app
|
||||
from packaging import version
|
||||
|
||||
from .wsgi_client import send_request
|
||||
|
||||
|
||||
def get_all_study_summaries(storage: BaseStorage) -> List[StudySummary]:
|
||||
if version.parse(optuna_ver) >= version.Version("3.0.0b0.dev"):
|
||||
summaries = storage.get_all_study_summaries(include_best_trial=True) # type: ignore
|
||||
else:
|
||||
summaries = storage.get_all_study_summaries() # type: ignore
|
||||
return summaries
|
||||
|
||||
|
||||
def objective(trial: optuna.trial.Trial) -> float:
|
||||
x = trial.suggest_float("x", -1, 1)
|
||||
return x
|
||||
|
||||
Reference in New Issue
Block a user