fixed corner case bugs in find_original_update_blocks

This commit is contained in:
Paul Gauthier 2023-05-29 07:12:57 -07:00
parent 87c902b285
commit 445c253abc

View file

@ -234,7 +234,9 @@ def find_original_update_blocks(content):
if not len(filename) or "`" in filename:
filename = processed[-2].splitlines()[-2].strip()
if not len(filename) or "`" in filename:
raise ValueError(f"Bad/missing filename. It should go right above {ORIGINAL}")
raise ValueError(
f"Bad/missing filename. It should go right above {ORIGINAL}"
)
except IndexError:
raise ValueError(f"Bad/missing filename. It should go right above {ORIGINAL}")
@ -247,8 +249,10 @@ def find_original_update_blocks(content):
raise ValueError(f"Expected {DIVIDER}")
updated_text = pieces.pop()
processed.append(updated_text)
updated_marker = pieces.pop()
processed.append(updated_marker)
if updated_marker.strip() != UPDATED:
raise ValueError(f"Expected {UPDATED}")