本文整理汇总了Python中arithmeticExpressions.Func类的典型用法代码示例。如果您正苦于以下问题:Python Func类的具体用法?Python Func怎么用?Python Func使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Func类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_evaluated_variable_abs
def test_evaluated_variable_abs(self):
a1 = ALitteral(Variable('X'))
absr = Func(a1, abs)
self.assertEqual(absr.value(self.eval2), abs(pi))
示例2: test_string_log_with_non_empty_evaluation
def test_string_log_with_non_empty_evaluation(self):
a1 = ALitteral('abc')
logr = Func(a1, log)
with self.assertRaises(TypeError):
logr.value(self.eval2)
示例3: test_evaluated_variable_log
def test_evaluated_variable_log(self):
a1 = ALitteral(Variable('X'))
logr = Func(a1, log)
self.assertEqual(logr.value(self.eval2), log(pi))
示例4: test_integer_log_with_non_empty_evaluation
def test_integer_log_with_non_empty_evaluation(self):
a1 = ALitteral(1)
logr = Func(a1, log)
self.assertEqual(logr.value(self.eval2), log(1))
示例5: test_bad_integer_log_with_empty_evaluation
def test_bad_integer_log_with_empty_evaluation(self):
a1 = ALitteral(-1)
logr = Func(a1, log)
with self.assertRaises(ValueError):
logr.value(self.eval1)
示例6: test_evaluated_variable_asinh
def test_evaluated_variable_asinh(self):
a1 = ALitteral(Variable('X'))
expr = Func(a1, asinh)
self.assertEqual(expr.value(self.eval2), asinh(pi))
示例7: test_self_litteral_asinh_with_non_empty_evaluation
def test_self_litteral_asinh_with_non_empty_evaluation(self):
a1 = SelfLitteral()
expr = Func(a1, asinh)
self.assertEqual(expr.value(self.eval2, pi), asinh(pi))
示例8: test_self_litteral_exp_with_empty_evaluation
def test_self_litteral_exp_with_empty_evaluation(self):
a1 = SelfLitteral()
expr = Func(a1, exp)
self.assertEqual(expr.value(self.eval1, pi), exp(pi))
示例9: test_integer_len_with_empty_evaluation
def test_integer_len_with_empty_evaluation(self):
a1 = ALitteral(1)
expr = Func(a1, len)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例10: test_float_exp_with_non_empty_evaluation
def test_float_exp_with_non_empty_evaluation(self):
a1 = ALitteral(pi)
expr = Func(a1, exp)
self.assertEqual(expr.value(self.eval2), exp(pi))
示例11: test_string_exp_with_empty_evaluation
def test_string_exp_with_empty_evaluation(self):
a1 = ALitteral('abc')
expr = Func(a1, exp)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例12: test_integer_exp_with_empty_evaluation
def test_integer_exp_with_empty_evaluation(self):
a1 = ALitteral(1)
expr = Func(a1, exp)
self.assertEqual(expr.value(self.eval1), exp(1))
示例13: test_self_litteral_abs_with_non_empty_evaluation
def test_self_litteral_abs_with_non_empty_evaluation(self):
a1 = SelfLitteral()
absr = Func(a1, abs)
self.assertEqual(absr.value(self.eval2, pi), abs(pi))
示例14: test_unevaluated_variable_abs
def test_unevaluated_variable_abs(self):
a1 = ALitteral(Variable('Y'))
absr = Func(a1, abs)
with self.assertRaises(ValueError):
absr.value(self.eval2)
示例15: test_string_asinh_with_non_empty_evaluation
def test_string_asinh_with_non_empty_evaluation(self):
a1 = ALitteral('abc')
expr = Func(a1, asinh)
with self.assertRaises(TypeError):
expr.value(self.eval2)