Address the comments by c-bata

This commit is contained in:
nabenabe0928
2023-11-27 07:30:37 +01:00
parent 685e284613
commit f29a6e9c0c
+6 -3
View File
@@ -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: