Implement JSON API for note

This commit is contained in:
c-bata
2022-03-18 13:32:23 +09:00
parent f43f522f20
commit aa35bfa709
5 changed files with 132 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
from unittest import TestCase
from unittest.mock import patch
from optuna_dashboard import _note as note
class NoteTestCase(TestCase):
@patch("optuna_dashboard._note.SYSTEM_ATTR_MAX_LENGTH", 5)
def test_split_and_concat_note_body(self) -> None:
for dummy_body_str, attr_len in [
("012", 1),
("01234", 1),
("012345", 2),
]:
with self.subTest(f"with_{dummy_body_str}_{attr_len}"):
attrs = note.split_body(dummy_body_str)
assert len(attrs) == attr_len
actual = note.concat_body(attrs)
assert dummy_body_str == actual