本文整理匯總了Python中arithmeticExpressions.Power.value方法的典型用法代碼示例。如果您正苦於以下問題:Python Power.value方法的具體用法?Python Power.value怎麽用?Python Power.value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arithmeticExpressions.Power
的用法示例。
在下文中一共展示了Power.value方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_self_litteral_float_power_with_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_self_litteral_float_power_with_empty_evaluation(self):
a1 = SelfLitteral()
a2 = ALitteral(sqrt(2))
expr = Power(a1, a2)
self.assertEqual(expr.value(self.eval1, 1), 1)
示例2: test_string_self_litteral_power_with_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_string_self_litteral_power_with_empty_evaluation(self):
a1 = ALitteral('abc')
a2 = SelfLitteral()
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval1, 1)
示例3: test_self_litteral_string_power_with_non_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_self_litteral_string_power_with_non_empty_evaluation(self):
a1 = SelfLitteral()
a2 = ALitteral('def')
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2, 1)
示例4: test_string_integer_power_with_non_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_string_integer_power_with_non_empty_evaluation(self):
a1 = ALitteral('abc')
a2 = ALitteral(20)
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例5: test_string_float_power_with_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_string_float_power_with_empty_evaluation(self):
a1 = ALitteral('abc')
a2 = ALitteral(sqrt(2))
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例6: test_evaluated_variable_self_litteral_power
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_evaluated_variable_self_litteral_power(self):
a1 = SelfLitteral()
a2 = ALitteral(Variable('X'))
expr = Power(a1, a2)
self.assertEqual(expr.value(self.eval2, 2), 2)
示例7: test_floats_power_with_non_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_floats_power_with_non_empty_evaluation(self):
a1 = ALitteral(pi)
a2 = ALitteral(sqrt(2))
expr = Power(a1, a2)
self.assertEqual(expr.value(self.eval2), pi ** sqrt(2))
示例8: test_evaluated_variable_evaluated_variable_power
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_evaluated_variable_evaluated_variable_power(self):
a1 = ALitteral(Variable('X'))
a2 = ALitteral(Variable('X'))
expr = Power(a1, a2)
self.assertEqual(expr.value(self.eval2), 1)
示例9: test_evaluated_variable_undefined_power
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_evaluated_variable_undefined_power(self):
a1 = ALitteral(Variable('X'))
a2 = UndefinedLitteral()
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2), 0
示例10: test_integers_power_with_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_integers_power_with_empty_evaluation(self):
a1 = ALitteral(10)
a2 = ALitteral(20)
expr = Power(a1, a2)
self.assertEqual(expr.value(self.eval1), 10 ** 20)
示例11: test_string_evaluated_variable_power
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_string_evaluated_variable_power(self):
a1 = ALitteral('abc')
a2 = ALitteral(Variable('X'))
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例12: test_undefined_float_power_with_non_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_undefined_float_power_with_non_empty_evaluation(self):
a1 = UndefinedLitteral()
a2 = ALitteral(sqrt(2))
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例13: test_float_undefined_power_with_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_float_undefined_power_with_empty_evaluation(self):
a1 = ALitteral(pi)
a2 = UndefinedLitteral()
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例14: test_integer_undefined_power_with_non_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_integer_undefined_power_with_non_empty_evaluation(self):
a1 = ALitteral(10)
a2 = UndefinedLitteral()
expr = Power(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例15: test_self_litteral_self_litteral_power_with_non_empty_evaluation
# 需要導入模塊: from arithmeticExpressions import Power [as 別名]
# 或者: from arithmeticExpressions.Power import value [as 別名]
def test_self_litteral_self_litteral_power_with_non_empty_evaluation(self):
a1 = SelfLitteral()
a2 = SelfLitteral()
expr = Power(a1, a2)
self.assertEqual(expr.value(self.eval2, 1), 1)