Allow trailing whitespace changes on raw content update.
This commit is contained in:
parent
d0498d2f5b
commit
ef615feac5
@ -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):
|
||||
|
@ -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,7 +75,10 @@ class HL:
|
||||
timestamp_to_datetime(doc_props[i].value), prop[1]
|
||||
)
|
||||
|
||||
test_case.assertEqual(get_raw_contents(doc), self.get_raw())
|
||||
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
|
||||
if self.children is None:
|
||||
|
Loading…
Reference in New Issue
Block a user