Skip to content

Commit f89f147

Browse files
Address review
1 parent e4a9de7 commit f89f147

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

Lib/test/test_generated_cases.py

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -248,29 +248,12 @@ def run_cases_test(self, input: str, expected: str):
248248
)
249249

250250
with open(self.temp_output_filename) as temp_output:
251-
lines = temp_output.readlines()
252-
while lines and lines[0].startswith(("// ", "#", " #", "\n")):
253-
lines.pop(0)
254-
while lines and lines[-1].startswith(("#", "\n")):
255-
lines.pop(-1)
256-
while lines and tier1_generator.INSTRUCTION_START_MARKER not in lines[0]:
257-
lines.pop(0)
258-
lines.pop(0)
259-
for instruction_end_marker_index, line in enumerate(lines):
260-
if tier1_generator.INSTRUCTION_END_MARKER in line:
261-
break
262-
else:
263-
assert False, "No instruction end marker found."
264-
for label_start_marker_index, line in enumerate(lines):
265-
if tier1_generator.LABEL_START_MARKER in line:
266-
break
267-
else:
268-
assert False, "No label start marker found."
269-
del lines[instruction_end_marker_index:label_start_marker_index+1]
270-
# Pop the label markers themselves
271-
lines.pop(0)
272-
lines.pop(-1)
273-
actual = "".join(lines)
251+
lines = temp_output.read()
252+
_, rest = lines.split(tier1_generator.INSTRUCTION_START_MARKER)
253+
instructions, labels_with_prelude_and_postlude = rest.split(tier1_generator.INSTRUCTION_END_MARKER)
254+
_, labels_with_postlude = labels_with_prelude_and_postlude.split(tier1_generator.LABEL_START_MARKER)
255+
labels, _ = labels_with_postlude.split(tier1_generator.LABEL_END_MARKER)
256+
actual = instructions + labels
274257
# if actual.strip() != expected.strip():
275258
# print("Actual:")
276259
# print(actual)

0 commit comments

Comments
 (0)