本文整理汇总了Python中test.testsTriggersExpressions.simpleTests.test_evaluation函数的典型用法代码示例。如果您正苦于以下问题:Python test_evaluation函数的具体用法?Python test_evaluation怎么用?Python test_evaluation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了test_evaluation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: eval_false
def eval_false(self, previousEvaluation, b1, b2):
lit1 = BLitteral(b1)
lit2 = BLitteral(b2)
token = None
trig = And(lit1, lit2)
simpleTests.test_evaluation(self, trig, previousEvaluation, token)
示例2: eval_true
def eval_true(self, previousEvaluation):
lit1 = BLitteral(True)
lit2 = BLitteral(True)
token = None
trig = And(lit1, lit2)
simpleTests.test_evaluation(self, trig, previousEvaluation, token, previousEvaluation)
示例3: succeed_randInt_with_unevaluated_variable_result
def succeed_randInt_with_unevaluated_variable_result(self, previousEvaluation):
import random
random.seed(0)
maxInt = ALitteral(3)
evaluation = previousEvaluation.copy()
evaluation[Variable('J')] = 2
trig = RandInt(Variable('J'), maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, evaluation)
evaluation[Variable('J')] = 2
trig = RandInt(Variable('J'), maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, evaluation)
evaluation[Variable('J')] = 1
trig = RandInt(Variable('J'), maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, evaluation)
evaluation[Variable('J')] = 0
trig = RandInt(Variable('J'), maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, evaluation)
evaluation[Variable('J')] = 1
trig = RandInt(Variable('J'), maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, evaluation)
示例4: eval_false
def eval_false(self, previousEvaluation):
lit1 = BLitteral(False)
lit2 = BLitteral(False)
token = None
trig = Or(lit1, lit2)
simpleTests.test_evaluation(self, trig, previousEvaluation, token)
示例5: timer_when_token_did_not_wait_enough
def timer_when_token_did_not_wait_enough(self, previousEvaluation):
trig = Timer(ALitteral(30))
token = Token(None, [], {})
for i in xrange(30):
simpleTests.test_evaluation(self, trig, previousEvaluation, token)
token.oneMoreFrame()
示例6: is_with_empty_previous_evaluation
def is_with_empty_previous_evaluation(self, isValue):
trig = Is(Variable('X'), ALitteral(isValue))
evaluation = Evaluation()
evaluation[Variable('X')] = isValue
simpleTests.test_evaluation(self, trig, self.eval1, None, evaluation)
示例7: test_succeed_randInt_with_variable_expected_result
def test_succeed_randInt_with_variable_expected_result(self):
import random
random.seed(0)
maxInt = ALitteral(3)
previousEvaluation = self.eval2
expected_result = Variable('X')
self.eval2[Variable('X')] = 2
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, previousEvaluation)
self.eval2[Variable('X')] = 2
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, previousEvaluation)
self.eval2[Variable('X')] = 1
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, previousEvaluation)
self.eval2[Variable('X')] = 0
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, previousEvaluation)
self.eval2[Variable('X')] = 1
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None, previousEvaluation)
示例8: failed_randInt_with_constant_expected_result
def failed_randInt_with_constant_expected_result(self, previousEvaluation):
import random
random.seed(0)
maxInt = ALitteral(3)
expected_result = ALitteral(1)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(0)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(2)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(2)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(0)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
示例9: test_randInd_maxInt_with_variable_expected_result_must_be_positive
def test_randInd_maxInt_with_variable_expected_result_must_be_positive(self):
maxInt = ALitteral(-2)
import random
random.seed(0)
expected_result = Variable('X')
self.eval2[Variable('X')] = ALitteral(2)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, self.eval2, None)
self.eval2[Variable('X')] = ALitteral(2)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, self.eval2, None)
self.eval2[Variable('X')] = ALitteral(1)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, self.eval2, None)
self.eval2[Variable('X')] = ALitteral(0)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, self.eval2, None)
self.eval2[Variable('X')] = ALitteral(1)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, self.eval2, None)
示例10: is_true_with_non_empty_previous_evaluation_1
def is_true_with_non_empty_previous_evaluation_1(self, isValue):
trig = Is(Variable('X'), ALitteral(isValue))
evaluation = Evaluation()
evaluation[Variable('X')] = isValue
evaluation[Variable('Y')] = 'abc'
evaluation[Variable('Z')] = 12.0
evaluation[Variable('T')] = True
simpleTests.test_evaluation(self, trig, self.eval2, None, evaluation)
示例11: rand_false
def rand_false(self, previousEvaluation):
rand = Rand(ALitteral(0.5))
import random
random.seed(0)
simpleTests.test_evaluation(self, rand, previousEvaluation, None)
simpleTests.test_evaluation(self, rand, previousEvaluation, None)
random.random()
random.random()
simpleTests.test_evaluation(self, rand, previousEvaluation, None)
random.random()
simpleTests.test_evaluation(self, rand, previousEvaluation, None)
random.random()
random.random()
simpleTests.test_evaluation(self, rand, previousEvaluation, None)
示例12: randInd_maxInt_with_constant_expected_result_must_be_positive
def randInd_maxInt_with_constant_expected_result_must_be_positive(self, previousEvaluation):
maxInt = ALitteral(-2)
import random
random.seed(0)
expected_result = ALitteral(2)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(2)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(1)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(0)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
expected_result = ALitteral(1)
trig = RandInt(expected_result, maxInt)
simpleTests.test_evaluation(self, trig, previousEvaluation, None)
示例13: test_success_two_kwargs_3
def test_success_two_kwargs_3(self):
trig = PropertyTriggerExpression('ETwoKW', [], {ALitteral(1): ALitteral(12), ALitteral('def'): ALitteral(12)})
token = None
simpleTests.test_evaluation(self, trig, self.eval2, token, self.eval2)
示例14: test_success_kwargs_string_string
def test_success_kwargs_string_string(self):
trig = PropertyTriggerExpression('ESS', [], {ALitteral('abc'): ALitteral('def')})
token = None
simpleTests.test_evaluation(self, trig, self.eval2, token, self.eval2)
示例15: test_success_kwargs_float_float
def test_success_kwargs_float_float(self):
trig = PropertyTriggerExpression('EFF', [], {ALitteral(sqrt(2)): ALitteral(pi)})
token = None
simpleTests.test_evaluation(self, trig, self.eval2, token, self.eval2)