def METHOD_NAME():
    pytest.raises(ValueError, lambda: legendre_poly(-1, x))
    assert legendre_poly(1, x, polys=True) == x.as_poly()
    assert legendre_poly(0, x) == 1
    assert legendre_poly(1, x) == x
    assert legendre_poly(2, x) == 3*x**2/2 - Rational(1, 2)
    assert legendre_poly(3, x) == 5*x**3/2 - 3*x/2
    assert legendre_poly(4, x) == 35*x**4/8 - 30*x**2/8 + Rational(3, 8)
    assert legendre_poly(5, x) == 63*x**5/8 - 70*x**3/8 + 15*x/8
    assert legendre_poly(6, x) == (231*x**6/16 - 315*x**4/16 +
                                   105*x**2/16 - Rational(5, 16))
    assert legendre_poly(1, polys=True) == x.as_poly()