WIP: Add support for updating a headline whole text contents #4
@ -903,7 +903,7 @@ class TestSerde(unittest.TestCase):
|
|||||||
hl.update_raw_contents(content)
|
hl.update_raw_contents(content)
|
||||||
|
|
||||||
# Check after update
|
# 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):
|
def print_tree(tree, indentation=0, headline=None):
|
||||||
|
@ -58,7 +58,7 @@ class HL:
|
|||||||
self.content = content
|
self.content = content
|
||||||
self.children = children
|
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))
|
test_case.assertEqual(self.title, get_raw(doc.title))
|
||||||
|
|
||||||
# Check properties
|
# Check properties
|
||||||
@ -75,6 +75,9 @@ class HL:
|
|||||||
timestamp_to_datetime(doc_props[i].value), prop[1]
|
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())
|
test_case.assertEqual(get_raw_contents(doc), self.get_raw())
|
||||||
|
|
||||||
# Check children
|
# Check children
|
||||||
|
Loading…
Reference in New Issue
Block a user