Basic output post-processing and comparison
| 69 | |
| 70 | |
| 71 | class Output: |
| 72 | """Basic output post-processing and comparison""" |
| 73 | |
| 74 | def __init__(self, string): |
| 75 | self.string = string |
| 76 | self.explanation = [] |
| 77 | |
| 78 | def __str__(self): |
| 79 | return self.string |
| 80 | |
| 81 | __hash__ = None |
| 82 | |
| 83 | def __eq__(self, other): |
| 84 | # Ignore constructor/destructor output which is prefixed with "###" |
| 85 | a = [ |
| 86 | line |
| 87 | for line in self.string.strip().splitlines() |
| 88 | if not line.startswith("###") |
| 89 | ] |
| 90 | b = _strip_and_dedent(other).splitlines() |
| 91 | if a == b: |
| 92 | return True |
| 93 | self.explanation = _make_explanation(a, b) |
| 94 | return False |
| 95 | |
| 96 | |
| 97 | class Unordered(Output): |