(self)
| 511 | assert approx(x, rel=5e-7, abs=0) != a |
| 512 | |
| 513 | def test_decimal(self): |
| 514 | within_1e6 = [ |
| 515 | (Decimal("1.000001"), Decimal("1.0")), |
| 516 | (Decimal("-1.000001"), Decimal("-1.0")), |
| 517 | ] |
| 518 | for a, x in within_1e6: |
| 519 | assert a == approx(x) |
| 520 | assert a == approx(x, rel=Decimal("5e-6"), abs=0) |
| 521 | assert a != approx(x, rel=Decimal("5e-7"), abs=0) |
| 522 | assert approx(x, rel=Decimal("5e-6"), abs=0) == a |
| 523 | assert approx(x, rel=Decimal("5e-7"), abs=0) != a |
| 524 | |
| 525 | def test_fraction(self): |
| 526 | within_1e6 = [ |