Skip to content

Commit

Permalink
test: add get_title_body to Note
Browse files Browse the repository at this point in the history
Add a new method `get_title_body` to the `Note` class to extract the title and body from a note's content. This function helps to improve the handling of note content and simplifies the process of accessing these key components.
  • Loading branch information
RedAtman committed Aug 6, 2024
1 parent 9090184 commit ed615aa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,22 @@ def test__note__nest_dict(self):
assert validate_result.keys() == note.d._nest_dict().keys()
assert "_modificationDate" in note.d.__dict__

def test_get_title_body(self):
list_content = [
# "",
# "SimplenoteTitle",
"SimplenoteTitle\nSimplenoteBody\nheader",
# "SimplenoteTitle\n\nSimplenoteBody\nheader",
"SimplenoteTitle\nSimplenoteBody\n\nheader",
# "SimplenoteTitle\n\nSimplenoteBody\n\nheader",
"SimplenoteTitle\nSimplenoteBody",
# "# SimplenoteTitle\n\nSimplenoteBody",
]
for content in list_content:
title, body = Note.get_title_body(content)
assert title == "SimplenoteTitle"
assert body.startswith("SimplenoteBody")


if __name__ == "__main__":
main()

0 comments on commit ed615aa

Please sign in to comment.