Ejemplo n.º 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)
Ejemplo n.º 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)
Ejemplo n.º 3
0
 def test_sub(self):
     f = ex11.sub_functions(abs, math.sqrt)
     self.assertEqual(f(9), 6)
     self.assertEqual(f(1 / 4), -1 / 4)
Ejemplo n.º 4
0
 def test_sub(self):
     f = ex11.sub_functions(abs,math.sqrt)
     self.assertEqual(f(9),6)
     self.assertEqual(f(1/4),-1/4)