Пример #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)
Пример #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)
Пример #3
0
 def test_derivative2(self):
     f = ex11.derivative(lambda x: x * x, 1)
     self.assertAlmostEqual(f(0), 1)
     self.assertAlmostEqual(f(9), 19)
Пример #4
0
 def test_derivative1(self):
     f = ex11.derivative(lambda x: x * x)
     self.assertAlmostEqual(f(0), 1e-3)
     self.assertAlmostEqual(f(9), 18.001)
Пример #5
0
 def test_derivative2(self):
     f = ex11.derivative(lambda x:x*x,1)
     self.assertAlmostEqual(f(0),1)
     self.assertAlmostEqual(f(9),19)
Пример #6
0
 def test_derivative1(self):
     f = ex11.derivative(lambda x:x*x)
     self.assertAlmostEqual(f(0),1e-3)
     self.assertAlmostEqual(f(9),18.001)