Beispiel #1
0
 def test_errors(self):
     def fake(x): raise Exception
     self.assertRaises(Exception,ex11.sum_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.sub_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.mul_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.div_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.compose(fake,abs),5)
     self.assertRaises(Exception,ex11.compose(abs,fake),5)
     self.assertRaises(Exception,ex11.inverse(fake),5)
     self.assertRaises(Exception,ex11.derivative(fake),5)
     self.assertRaises(Exception,ex11.integral_function(fake),5)
Beispiel #2
0
 def test_errors(self):
     def fake(x): raise Exception
     self.assertRaises(Exception,ex11.sum_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.sub_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.mul_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.div_functions(fake,abs),5)
     self.assertRaises(Exception,ex11.compose(fake,abs),5)
     self.assertRaises(Exception,ex11.compose(abs,fake),5)
     self.assertRaises(Exception,ex11.inverse(fake),5)
     self.assertRaises(Exception,ex11.derivative(fake),5)
     self.assertRaises(Exception,ex11.integral_function(fake),5)
Beispiel #3
0
 def test_sum(self):
     f = ex11.sum_functions(abs, math.sqrt)
     self.assertEqual(f(9), 12)
     self.assertEqual(f(1 / 4), 3 / 4)
Beispiel #4
0
 def test_sum(self):
     f = ex11.sum_functions(abs,math.sqrt)
     self.assertEqual(f(9),12)
     self.assertEqual(f(1/4),3/4)