mirror of
https://github.com/wassname/optuna-dashboard.git
synced 2026-09-09 11:28:14 +08:00
Address the comments by c-bata
This commit is contained in:
@@ -302,21 +302,24 @@ class APITestCase(TestCase):
|
||||
request_body: dict[str, int | str] = {"body": "Test note.", "version": 1}
|
||||
status, study = self._test_save_trial_note(request_body)
|
||||
self.assertEqual(status, 204)
|
||||
assert study.system_attrs == {
|
||||
expected_system_attrs = {
|
||||
note_ver_key(0): request_body["version"],
|
||||
f"{note_str_key_prefix(0)}{0}": request_body["body"],
|
||||
}
|
||||
for k, v in expected_system_attrs.items():
|
||||
assert k in study.system_attrs
|
||||
assert study.system_attrs[k] == v
|
||||
|
||||
def test_save_trial_note_with_wrong_version(self) -> None:
|
||||
request_body: dict[str, int | str] = {"body": "Test note.", "version": 0}
|
||||
status, study = self._test_save_trial_note(request_body)
|
||||
self.assertEqual(status, 409)
|
||||
assert study.system_attrs == {}
|
||||
assert note_ver_key(0) not in study.system_attrs
|
||||
|
||||
def test_save_trial_note_empty(self) -> None:
|
||||
status, study = self._test_save_trial_note(request_body={})
|
||||
self.assertEqual(status, 400)
|
||||
assert study.system_attrs == {}
|
||||
assert note_ver_key(0) not in study.system_attrs
|
||||
|
||||
@pytest.mark.skipif(sys.version_info < (3, 8), reason="BoTorch dropped Python3.7 support")
|
||||
def test_skip_trial(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user