(self)
| 488 | assert op(a, approx(x)) |
| 489 | |
| 490 | def test_expecting_nan(self): |
| 491 | examples = [ |
| 492 | (eq, nan, nan), |
| 493 | (eq, -nan, -nan), |
| 494 | (eq, nan, -nan), |
| 495 | (ne, 0.0, nan), |
| 496 | (ne, inf, nan), |
| 497 | ] |
| 498 | for op, a, x in examples: |
| 499 | # Nothing is equal to NaN by default. |
| 500 | assert a != approx(x) |
| 501 | |
| 502 | # If ``nan_ok=True``, then NaN is equal to NaN. |
| 503 | assert op(a, approx(x, nan_ok=True)) |
| 504 | |
| 505 | def test_int(self): |
| 506 | within_1e6 = [(1000001, 1000000), (-1000001, -1000000)] |