fix by review

This commit is contained in:
moririn2528
2023-09-04 12:15:29 +09:00
parent 7a97d3db5a
commit 1d7d5a7252
5 changed files with 52 additions and 12 deletions
+24
View File
@@ -157,6 +157,30 @@ class APITestCase(TestCase):
assert better.number == 2
assert worse.number == 1
def test_report_preference_when_typo_mode(self) -> None:
storage = optuna.storages.InMemoryStorage()
study = create_study(storage=storage)
for _ in range(3):
trial = study.ask()
study.mark_comparison_ready(trial)
app = create_app(storage)
study_id = study._study._study_id
status, _, _ = send_request(
app,
f"/api/studies/{study_id}/preference",
"POST",
body=json.dumps(
{
"mode": "ChoseWorst",
"candidates": [0, 1, 2],
"clicked": 1,
}
),
content_type="application/json",
)
self.assertEqual(status, 400)
def test_skip_trial(self) -> None:
storage = optuna.storages.InMemoryStorage()
study = create_study(storage=storage)