adapt test on __call__ for polynom

This commit is contained in:
Lafrite 2015-03-07 09:15:21 +01:00
parent cd911a5513
commit b3a07bf6e4

View File

@ -33,20 +33,19 @@ class TestPolynom(unittest.TestCase):
def test_eval_base(self): def test_eval_base(self):
p = Polynom([1, 2]) p = Polynom([1, 2])
self.assertEqual(p(3).simplify(), 7) self.assertEqual(p(3), 7)
def test_eval_const(self): def test_eval_const(self):
p = Polynom([1]) p = Polynom([1])
self.assertEqual(p(3).simplify(), 1) self.assertEqual(p(3), 1)
def test_eval_const_neg(self): def test_eval_const_neg(self):
p = Polynom([-1]) p = Polynom([-1])
self.assertEqual(p(3).simplify(), -1) self.assertEqual(p(3), -1)
def test_eval_poly(self): def test_eval_poly(self):
p = Polynom([1, 2]) p = Polynom([1, 2])
hp1 = Expression("h+1") self.assertEqual(p("h+1"), Polynom([3,2], "h"))
self.assertEqual(p(hp1).simplify(), Polynom([3,2], "h"))
#def test_print(self): #def test_print(self):
# p = Polynom([1,2,3]) # p = Polynom([1,2,3])