From 60ad95847264473ec7749f216b6d5863bc391d64 Mon Sep 17 00:00:00 2001 From: Pablito Date: Wed, 4 Dec 2024 14:46:18 +0100 Subject: [PATCH] Added type hints for tests --- maths/polynomials/legendre.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/maths/polynomials/legendre.py b/maths/polynomials/legendre.py index 5bfa86409..716b0d845 100644 --- a/maths/polynomials/legendre.py +++ b/maths/polynomials/legendre.py @@ -23,29 +23,29 @@ def legendre(n: int) -> [float]: return legendre_polynomial.deriv(n).coef.tolist() -def test_legendre_0(): +def test_legendre_0() -> None: """Test the 0th Legendre polynomial.""" assert legendre(0) == [1.0], "The 0th Legendre polynomial should be [1.0]" -def test_legendre_1(): +def test_legendre_1() -> None: """Test the 1st Legendre polynomial.""" assert legendre(1) == [0.0, 1.0], "The 1st Legendre polynomial should be [0.0, 1.0]" -def test_legendre_2(): +def test_legendre_2() -> None: """Test the 2nd Legendre polynomial.""" assert legendre(2) == [-0.5, 0.0, 1.5] "The 2nd Legendre polynomial should be [-0.5, 0.0, 1.5]" -def test_legendre_3(): +def test_legendre_3() -> None: """Test the 3rd Legendre polynomial.""" assert legendre(3) == [0.0, -1.5, 0.0, 2.5] "The 3rd Legendre polynomial should be [0.0, -1.5, 0.0, 2.5]" -def test_legendre_4(): +def test_legendre_4() -> None: """Test the 4th Legendre polynomial.""" assert legendre(4) == pytest.approx([0.375, 0.0, -3.75, 0.0, 4.375]) "The 4th Legendre polynomial should be [0.375, 0.0, -3.75, 0.0, 4.375]"