From 07ea8a642a86f2e2bf002935d9bd49c2f197644e Mon Sep 17 00:00:00 2001 From: Contramundum Date: Mon, 4 Sep 2023 15:25:19 +0900 Subject: [PATCH] Fix test --- optuna_dashboard/preferential/_study.py | 2 +- python_tests/preferential/test_system_attrs.py | 2 +- python_tests/test_serializers.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/optuna_dashboard/preferential/_study.py b/optuna_dashboard/preferential/_study.py index a7f494d4..ce691f42 100644 --- a/optuna_dashboard/preferential/_study.py +++ b/optuna_dashboard/preferential/_study.py @@ -263,7 +263,7 @@ class PreferentialStudy: to generate a new trial if this method returns :obj:`True`, and to wait for human evaluation if this method returns :obj:`False`. """ - return len(self.best_trials) < get_n_generate(self._study._study_id, self._study._storage) + return len(self.best_trials) < get_n_generate(self._study.system_attrs) def get_best_trials(study_id: int, storage: optuna.storages.BaseStorage) -> list[FrozenTrial]: diff --git a/python_tests/preferential/test_system_attrs.py b/python_tests/preferential/test_system_attrs.py index d36a3fef..10448d48 100644 --- a/python_tests/preferential/test_system_attrs.py +++ b/python_tests/preferential/test_system_attrs.py @@ -13,7 +13,7 @@ from ..storage_supplier import StorageSupplier @parametrize_storages def test_report_and_get_preferences(storage_supplier: Callable[[], StorageSupplier]) -> None: with storage_supplier() as storage: - study = optuna.create_study(n_generate=4, storage=storage) + study = optuna.create_study(storage=storage) study.ask() study.ask() diff --git a/python_tests/test_serializers.py b/python_tests/test_serializers.py index a75db32d..a90e0de7 100644 --- a/python_tests/test_serializers.py +++ b/python_tests/test_serializers.py @@ -24,7 +24,7 @@ def test_serialize_dict() -> None: def test_get_study_detail_is_preferential() -> None: storage = optuna.storages.InMemoryStorage() - study = create_study(storage=storage) + study = create_study(n_generate=4, storage=storage) study_summaries = get_study_summaries(storage) assert len(study_summaries) == 1 @@ -46,7 +46,7 @@ def test_get_study_detail_is_not_preferential() -> None: def test_get_study_summary_is_preferential() -> None: storage = optuna.storages.InMemoryStorage() - create_study(storage=storage) + create_study(n_generate=4, storage=storage) study_summaries = get_study_summaries(storage) assert len(study_summaries) == 1