Fix for diff parser : Make sure that start_pos are growing always

The problem was that functions/classes were sometimes not well positioned. Now
all diff tests are ensuring that leaves always grow.
This commit is contained in:
Dave Halter
2018-12-28 21:49:49 +01:00
parent 29456a6c0a
commit 0ef4809377
2 changed files with 8 additions and 12 deletions

View File

@@ -43,9 +43,8 @@ def _assert_valid_graph(node):
except AttributeError:
previous_leaf = node.get_previous_leaf()
if previous_leaf is not None:
if previous_leaf.type != 'error_leaf' or previous_leaf.token_type != 'INDENT':
assert previous_leaf.end_pos == node.get_start_pos_of_prefix(), \
(previous_leaf, node)
assert previous_leaf.end_pos <= node.start_pos, \
(previous_leaf, node)
return
for child in children: