WIP: Add support for updating a headline whole text contents #4

Draft
kenkeiras wants to merge 11 commits from support-updating-raw-note-contents into develop
2 changed files with 6 additions and 3 deletions
Showing only changes of commit ef615feac5 - Show all commits

View File

@ -903,7 +903,7 @@ class TestSerde(unittest.TestCase):
hl.update_raw_contents(content)
# Check after update
ex.assert_matches(self, hl)
ex.assert_matches(self, hl, accept_trailing_whitespace_changes=True)
def print_tree(tree, indentation=0, headline=None):

View File

@ -58,7 +58,7 @@ class HL:
self.content = content
self.children = children
def assert_matches(self, test_case: unittest.TestCase, doc):
def assert_matches(self, test_case: unittest.TestCase, doc, accept_trailing_whitespace_changes=False):
test_case.assertEqual(self.title, get_raw(doc.title))
# Check properties
@ -75,6 +75,9 @@ class HL:
timestamp_to_datetime(doc_props[i].value), prop[1]
)
if accept_trailing_whitespace_changes:
test_case.assertEqual(get_raw_contents(doc).rstrip(), self.get_raw().rstrip())
else:
test_case.assertEqual(get_raw_contents(doc), self.get_raw())
# Check children