| 191 | # If comparing against a float or double, don't do a strict comparison |
| 192 | # See: https://peps.python.org/pep-0485/#proposed-implementation |
| 193 | def compare_float(x, y, rel_tol=1e-9, abs_tol=0.0): |
| 194 | # For the purposes of test validation, we want to treat nans as equal. The |
| 195 | # floating point spec defines nan != nan. |
| 196 | if math.isnan(x) and math.isnan(y): |
| 197 | return True |
| 198 | if math.isinf(x) or math.isinf(y): |
| 199 | return x == y |
| 200 | return abs(x - y) <= max(rel_tol * max(abs(x), abs(y)), abs_tol) |
| 201 | |
| 202 | # Represents a column in a row |
| 203 | class ResultColumn(object): |