Skip to content

Commit

Permalink
Fix test_generated_cases.py by stripping preprocessor prefix/suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
gvanrossum committed Oct 31, 2023
1 parent 75605c7 commit 5e84476
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Lib/test/test_generated_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,19 @@ 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("// "):
while lines and lines[0].startswith(("// ", "#", " #", "\n")):
lines.pop(0)
while lines and lines[-1].startswith(("#", "\n")):
lines.pop(-1)
actual = "".join(lines)
# if actual.rstrip() != expected.rstrip():
# if actual.strip() != expected.strip():
# print("Actual:")
# print(actual)
# print("Expected:")
# print(expected)
# print("End")

self.assertEqual(actual.rstrip(), expected.rstrip())
self.assertEqual(actual.strip(), expected.strip())

def test_inst_no_args(self):
input = """
Expand Down

0 comments on commit 5e84476

Please sign in to comment.