本文整理汇总了Python中arithmeticExpressions.EuclideanDivision类的典型用法代码示例。如果您正苦于以下问题:Python EuclideanDivision类的具体用法?Python EuclideanDivision怎么用?Python EuclideanDivision使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EuclideanDivision类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_evaluated_variable_self_litteral_euclideandivision
def test_evaluated_variable_self_litteral_euclideandivision(self):
a1 = SelfLitteral()
a2 = ALitteral(Variable('X'))
expr = EuclideanDivision(a1, a2)
self.assertEqual(expr.value(self.eval2, 2), 2)
示例2: test_strings_euclideandivision_with_empty_evaluation
def test_strings_euclideandivision_with_empty_evaluation(self):
a1 = ALitteral('abc')
a2 = ALitteral('def')
expr = EuclideanDivision(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例3: test_undefined_self_litteral_euclideandivision_with_non_empty_evaluation
def test_undefined_self_litteral_euclideandivision_with_non_empty_evaluation(self):
a1 = UndefinedLitteral()
a2 = SelfLitteral()
expr = EuclideanDivision(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2, 1)
示例4: test_self_litteral_float_euclideandivision_with_empty_evaluation
def test_self_litteral_float_euclideandivision_with_empty_evaluation(self):
a1 = SelfLitteral()
a2 = ALitteral(sqrt(2))
expr = EuclideanDivision(a1, a2)
self.assertEqual(expr.value(self.eval1, 1), 0)
示例5: test_self_litteral_self_litteral_euclideandivision_with_non_empty_evaluation
def test_self_litteral_self_litteral_euclideandivision_with_non_empty_evaluation(self):
a1 = SelfLitteral()
a2 = SelfLitteral()
expr = EuclideanDivision(a1, a2)
self.assertEqual(expr.value(self.eval2, 1), 1)
示例6: test_bad_float_euclideandivision_with_non_empty_evaluation
def test_bad_float_euclideandivision_with_non_empty_evaluation(self):
a1 = ALitteral(pi)
a2 = ALitteral(0.0)
expr = EuclideanDivision(a1, a2)
with self.assertRaises(ArithmeticError):
expr.value(self.eval2)
示例7: test_undefined_integer_euclideandivision_with_empty_evaluation
def test_undefined_integer_euclideandivision_with_empty_evaluation(self):
a1 = UndefinedLitteral()
a2 = ALitteral(20)
expr = EuclideanDivision(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval1)
示例8: test_evaluated_variable_float_euclideandivision
def test_evaluated_variable_float_euclideandivision(self):
a1 = ALitteral(Variable('X'))
a2 = ALitteral(sqrt(2))
expr = EuclideanDivision(a1, a2)
self.assertEqual(expr.value(self.eval2), 0)
示例9: test_bad_integer_euclideandivision_with_empty_evaluation
def test_bad_integer_euclideandivision_with_empty_evaluation(self):
a1 = ALitteral(10)
a2 = ALitteral(0)
expr = EuclideanDivision(a1, a2)
with self.assertRaises(ArithmeticError):
expr.value(self.eval1)
示例10: test_evaluated_variable_string_euclideandivision
def test_evaluated_variable_string_euclideandivision(self):
a1 = ALitteral(Variable('X'))
a2 = ALitteral('def')
expr = EuclideanDivision(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例11: test_integers_euclideandivision_with_non_empty_evaluation
def test_integers_euclideandivision_with_non_empty_evaluation(self):
a1 = ALitteral(10)
a2 = ALitteral(20)
expr = EuclideanDivision(a1, a2)
self.assertEqual(expr.value(self.eval2), 0)
示例12: test_integer_evaluated_variable_euclideandivision
def test_integer_evaluated_variable_euclideandivision(self):
a1 = ALitteral(10)
a2 = ALitteral(Variable('X'))
expr = EuclideanDivision(a1, a2)
self.assertEqual(expr.value(self.eval2), 10)
示例13: test_undefined_float_euclideandivision_with_non_empty_evaluation
def test_undefined_float_euclideandivision_with_non_empty_evaluation(self):
a1 = UndefinedLitteral()
a2 = ALitteral(sqrt(2))
expr = EuclideanDivision(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例14: test_string_undefined_euclideandivision_with_non_empty_evaluation
def test_string_undefined_euclideandivision_with_non_empty_evaluation(self):
a1 = ALitteral('abc')
a2 = UndefinedLitteral()
expr = EuclideanDivision(a1, a2)
with self.assertRaises(TypeError):
expr.value(self.eval2)
示例15: test_unevaluated_variable_self_litteral_euclideandivision
def test_unevaluated_variable_self_litteral_euclideandivision(self):
a1 = ALitteral(Variable('Y'))
a2 = SelfLitteral()
expr = EuclideanDivision(a1, a2)
with self.assertRaises(ValueError):
expr.value(self.eval2, 1)