Skip to content

Commit

Permalink
Refactor test polynomial
Browse files Browse the repository at this point in the history
  • Loading branch information
bobleesj committed Oct 29, 2024
1 parent c8258de commit 81c402e
Showing 1 changed file with 16 additions and 17 deletions.
33 changes: 16 additions & 17 deletions tests/test_polynomials.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@


@pytest.mark.parametrize(
"inputs, expected",
"linear_coefficient, constant, expected",
[
([0, 0], 0),
([-99.99, 12.50], 9.936397678254531),
([-4, 0], 2),
([10, 0], 0),
([-7, -7], 3.04891734),
([100, 72], 0),
([1, 3], 0),
([0, -7], 0),
([-9, 0], 3),
([-9, 3], 2.8169),
([[2, 2], 2], [0, 0]),
([[[2, 2], [2, 2]], 2], [[0, 0], [0, 0]]),
([[[[3, 2], [-2, -2], [100, 0]]], 2], [[[0, 0], [0, 0], [0, 0]]]),
(0, 0, 0),
(-99.99, 12.50, 9.936397678254531),
(-4, 0, 2),
(10, 0, 0),
(-7, -7, 3.04891734),
(100, 72, 0),
(1, 3, 0),
(0, -7, 0),
(-9, 0, 3),
(-9, 3, 2.8169),
([2, 2], 2, [0, 0]),
([[2, 2], [2, 2]], 2, [[0, 0], [0, 0]]),
([[[3, 2], [-2, -2], [100, 0]]], 2, [[[0, 0], [0, 0], [0, 0]]]),
],
)
def test_rooth(inputs, expected):
linear_coefficient, constants = inputs
actual = compute_root(linear_coefficient, constants)
def test_rooth(linear_coefficient, constant, expected):
actual = compute_root(linear_coefficient, constant)
np.testing.assert_allclose(actual, expected, rtol=1e-4)

0 comments on commit 81c402e

Please sign in to comment.