Skip to content

Commit cf4738f

Browse files
committed
Ignore in-between whitespaces when doing string comparisons
Signed-off-by: Jing Chen <[email protected]>
1 parent f9156c1 commit cf4738f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

tests/test_examples_run.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,12 @@ def compare_to_execution(self, execution_result: ExecutionResult) -> bool:
7575
return execution_result.error_code == ExecutionErrorCode.RUNTIME_ERROR
7676

7777
# At this point, it's NO_ERROR, so check for results
78+
# Note string comparison ignores whitespaces
7879
actual_result = execution_result.result
7980
if actual_result is not None and self.results is not None:
80-
actual_result_stripped = actual_result.strip()
81+
actual_result_stripped = actual_result.replace(" ", "").strip()
8182
for expected_result in self.results:
82-
expected_result_stripped = expected_result.strip()
83+
expected_result_stripped = expected_result.replace(" ", "").strip()
8384
if actual_result_stripped == expected_result_stripped:
8485
return True
8586
return False

0 commit comments

Comments
 (0)