From 81c402e5d91444837a0ce957097102d51943f5d3 Mon Sep 17 00:00:00 2001 From: Sangjoon Bob Lee Date: Tue, 29 Oct 2024 10:30:22 -0400 Subject: [PATCH] Refactor test polynomial --- tests/test_polynomials.py | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/tests/test_polynomials.py b/tests/test_polynomials.py index ba3b58f..51912f0 100644 --- a/tests/test_polynomials.py +++ b/tests/test_polynomials.py @@ -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)