[instancer.solver] Use pytest.approx() in tests

This commit is contained in:
Behdad Esfahbod 2022-08-08 13:10:08 -06:00
parent d03879607b
commit 743033d755

View File

@ -59,7 +59,7 @@ class RebaseTentTest(object):
pytest.param(
(0, .4, 1), (-1, 0, .5),
[
(1, (0.0, 0.8, 1.99993896484375)),
(1, (0.0, 0.8, pytest.approx(1.9999389))),
]
),
@ -68,14 +68,14 @@ class RebaseTentTest(object):
(0, .25, 1), (-1, 0, .4),
[
(1, (0.0, 0.625, 1.0)),
(0.7999999999999999, (0.625, 1.0, 1.0)),
(pytest.approx(0.8), (0.625, 1.0, 1.0)),
]
),
pytest.param(
(.25, .3, 1.05), (0, .2, .4),
[
(1, (0.24999999999999994, 0.4999999999999999, 1.0)),
(0.8666666666666667, (0.4999999999999999, 1.0, 1.0)),
(1, (pytest.approx(.25), pytest.approx(.5), 1.0)),
(pytest.approx(2.6/3), (pytest.approx(.5), 1.0, 1.0)),
]
),
# Case 4 boundary
@ -106,7 +106,7 @@ class RebaseTentTest(object):
(.0, .5, 2), (.2, .5, .8),
[
(1, None),
(-0.20000000000000007, (0, 1, 1)),
(pytest.approx(-.2), (0, 1, 1)),
(-.6, (-1, -1, 0)),
]
),
@ -116,7 +116,7 @@ class RebaseTentTest(object):
(.0, .5, 2), (.2, .5, 1),
[
(1, None),
(-0.33333333333333337, (0, 1, 1)),
(pytest.approx(-1/3), (0, 1, 1)),
(-.6, (-1, -1, 0)),
]
),
@ -168,8 +168,8 @@ class RebaseTentTest(object):
(.3, .5, .7), (.1, .5, .9),
[
(1, None),
(-1, (0, 0.4999999999999999, 1)),
(-1, (0.4999999999999999, 1, 1)),
(-1, (0, pytest.approx(.5), 1)),
(-1, (pytest.approx(.5), 1, 1)),
(-1, (-1, -.5, 0)),
(-1, (-1, -1, -.5)),
]