(self)
| 567 | assert [1, 2] != approx([1, 2, 3]) |
| 568 | |
| 569 | def test_tuple(self): |
| 570 | actual = (1 + 1e-7, 2 + 1e-8) |
| 571 | expected = (1, 2) |
| 572 | |
| 573 | # Return false if any element is outside the tolerance. |
| 574 | assert actual == approx(expected, rel=5e-7, abs=0) |
| 575 | assert actual != approx(expected, rel=5e-8, abs=0) |
| 576 | assert approx(expected, rel=5e-7, abs=0) == actual |
| 577 | assert approx(expected, rel=5e-8, abs=0) != actual |
| 578 | |
| 579 | def test_tuple_wrong_len(self): |
| 580 | assert (1, 2) != approx((1,)) |