def test_legtrim(self) : coef = [2, -1, 1, 0] # Test exceptions assert_raises(ValueError, leg.legtrim, coef, -1) # Test results assert_equal(leg.legtrim(coef), coef[:-1]) assert_equal(leg.legtrim(coef, 1), coef[:-3]) assert_equal(leg.legtrim(coef, 2), [0])
def test_legtrim(self) : coef = [2, -1, 1, 0] # Test exceptions assert_raises(ValueError, leg.legtrim, coef, -1) # Test results assert_equal(leg.legtrim(coef), coef[:-1]) assert_equal(leg.legtrim(coef, 1), coef[:-3]) assert_equal(leg.legtrim(coef, 2), [0])
def trim(x) : return leg.legtrim(x, tol=1e-6)
def trim(x) : return leg.legtrim(x, tol=1e-6)