Skip to content

Commit

Permalink
Address review
Browse files Browse the repository at this point in the history
  • Loading branch information
Fidget-Spinner committed Jan 25, 2025
1 parent e4a9de7 commit f89f147
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions Lib/test/test_generated_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,29 +248,12 @@ def run_cases_test(self, input: str, expected: str):
)

with open(self.temp_output_filename) as temp_output:
lines = temp_output.readlines()
while lines and lines[0].startswith(("// ", "#", " #", "\n")):
lines.pop(0)
while lines and lines[-1].startswith(("#", "\n")):
lines.pop(-1)
while lines and tier1_generator.INSTRUCTION_START_MARKER not in lines[0]:
lines.pop(0)
lines.pop(0)
for instruction_end_marker_index, line in enumerate(lines):
if tier1_generator.INSTRUCTION_END_MARKER in line:
break
else:
assert False, "No instruction end marker found."
for label_start_marker_index, line in enumerate(lines):
if tier1_generator.LABEL_START_MARKER in line:
break
else:
assert False, "No label start marker found."
del lines[instruction_end_marker_index:label_start_marker_index+1]
# Pop the label markers themselves
lines.pop(0)
lines.pop(-1)
actual = "".join(lines)
lines = temp_output.read()
_, rest = lines.split(tier1_generator.INSTRUCTION_START_MARKER)
instructions, labels_with_prelude_and_postlude = rest.split(tier1_generator.INSTRUCTION_END_MARKER)
_, labels_with_postlude = labels_with_prelude_and_postlude.split(tier1_generator.LABEL_START_MARKER)
labels, _ = labels_with_postlude.split(tier1_generator.LABEL_END_MARKER)
actual = instructions + labels
# if actual.strip() != expected.strip():
# print("Actual:")
# print(actual)
Expand Down

0 comments on commit f89f147

Please sign in to comment.