Skip to content

Commit 81c402e

Browse files
committed
Refactor test polynomial
1 parent c8258de commit 81c402e

File tree

1 file changed

+16
-17
lines changed

1 file changed

+16
-17
lines changed

tests/test_polynomials.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@
55

66

77
@pytest.mark.parametrize(
8-
"inputs, expected",
8+
"linear_coefficient, constant, expected",
99
[
10-
([0, 0], 0),
11-
([-99.99, 12.50], 9.936397678254531),
12-
([-4, 0], 2),
13-
([10, 0], 0),
14-
([-7, -7], 3.04891734),
15-
([100, 72], 0),
16-
([1, 3], 0),
17-
([0, -7], 0),
18-
([-9, 0], 3),
19-
([-9, 3], 2.8169),
20-
([[2, 2], 2], [0, 0]),
21-
([[[2, 2], [2, 2]], 2], [[0, 0], [0, 0]]),
22-
([[[[3, 2], [-2, -2], [100, 0]]], 2], [[[0, 0], [0, 0], [0, 0]]]),
10+
(0, 0, 0),
11+
(-99.99, 12.50, 9.936397678254531),
12+
(-4, 0, 2),
13+
(10, 0, 0),
14+
(-7, -7, 3.04891734),
15+
(100, 72, 0),
16+
(1, 3, 0),
17+
(0, -7, 0),
18+
(-9, 0, 3),
19+
(-9, 3, 2.8169),
20+
([2, 2], 2, [0, 0]),
21+
([[2, 2], [2, 2]], 2, [[0, 0], [0, 0]]),
22+
([[[3, 2], [-2, -2], [100, 0]]], 2, [[[0, 0], [0, 0], [0, 0]]]),
2323
],
2424
)
25-
def test_rooth(inputs, expected):
26-
linear_coefficient, constants = inputs
27-
actual = compute_root(linear_coefficient, constants)
25+
def test_rooth(linear_coefficient, constant, expected):
26+
actual = compute_root(linear_coefficient, constant)
2827
np.testing.assert_allclose(actual, expected, rtol=1e-4)

0 commit comments

Comments
 (0)