本文整理汇总了Python中arithmeticExpressions.Product.value方法的典型用法代码示例。如果您正苦于以下问题:Python Product.value方法的具体用法?Python Product.value怎么用?Python Product.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arithmeticExpressions.Product
的用法示例。
在下文中一共展示了Product.value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_self_litteral_string_product_with_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_self_litteral_string_product_with_empty_evaluation(self):
a1 = SelfLitteral()
a2 = ALitteral('def')
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval1, 1), 'def')
示例2: test_strings_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_strings_product_with_non_empty_evaluation(self):
a1 = ALitteral('abc')
a2 = ALitteral('def')
expr = Product(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例3: test_integer_float_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_integer_float_product_with_non_empty_evaluation(self):
a1 = ALitteral(10)
a2 = ALitteral(sqrt(2))
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval2), 10 * sqrt(2))
示例4: test_integer_undefined_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_integer_undefined_product_with_non_empty_evaluation(self):
a1 = ALitteral(10)
a2 = UndefinedLitteral()
expr = Product(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例5: test_unevaluated_variable_self_litteral_product
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_unevaluated_variable_self_litteral_product(self):
a1 = ALitteral(Variable('Y'))
a2 = SelfLitteral()
expr = Product(a1, a2)
with self.assertRaises(ValueError):
expr.value(self.eval2, 1)
示例6: test_integer_string_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_integer_string_product_with_non_empty_evaluation(self):
a1 = ALitteral(10)
a2 = ALitteral('def')
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval2), 10 * 'def')
示例7: test_evaluated_variable_undefined_product
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_evaluated_variable_undefined_product(self):
a1 = ALitteral(Variable('X'))
a2 = UndefinedLitteral()
expr = Product(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2), 0
示例8: test_undefined_self_litteral_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_undefined_self_litteral_product_with_non_empty_evaluation(self):
a1 = UndefinedLitteral()
a2 = SelfLitteral()
expr = Product(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2, 1)
示例9: test_evaluated_variable_string_product
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_evaluated_variable_string_product(self):
a1 = ALitteral(Variable('X'))
a2 = ALitteral('def')
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval2), 'def')
示例10: test_evaluated_variable_float_product
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_evaluated_variable_float_product(self):
a1 = ALitteral(Variable('X'))
a2 = ALitteral(sqrt(2))
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval2), sqrt(2))
示例11: test_evaluated_variable_integer_product
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_evaluated_variable_integer_product(self):
a1 = ALitteral(Variable('X'))
a2 = ALitteral(20)
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval2), 20)
示例12: test_undefined_float_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_undefined_float_product_with_non_empty_evaluation(self):
a1 = UndefinedLitteral()
a2 = ALitteral(sqrt(2))
expr = Product(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例13: test_float_undefined_product_with_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_float_undefined_product_with_empty_evaluation(self):
a1 = ALitteral(pi)
a2 = UndefinedLitteral()
expr = Product(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例14: test_self_litteral_float_product_with_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_self_litteral_float_product_with_empty_evaluation(self):
a1 = SelfLitteral()
a2 = ALitteral(sqrt(2))
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval1, 1), sqrt(2))
示例15: test_integers_product_with_non_empty_evaluation
# 需要导入模块: from arithmeticExpressions import Product [as 别名]
# 或者: from arithmeticExpressions.Product import value [as 别名]
def test_integers_product_with_non_empty_evaluation(self):
a1 = ALitteral(10)
a2 = ALitteral(20)
expr = Product(a1, a2)
self.assertEqual(expr.value(self.eval2), 200)