Beispiel #1
0
    def test_predicate_condition_2 (self):
        test = NotifyTestObject ()

        predicate = PredicateCondition (bool, None)
        predicate.store (test.simple_handler)

        predicate.update (False)

        test.assert_results (False)
Beispiel #2
0
    def test_predicate_condition_3(self):
        test = NotifyTestObject()

        predicate = PredicateCondition(lambda x: x > 10, 0)
        predicate.store(test.simple_handler)

        predicate.update(10)
        predicate.update(20)
        predicate.update(-5)

        test.assert_results(False, True, False)
Beispiel #3
0
    def test_predicate_condition_3 (self):
        test = NotifyTestObject ()

        predicate = PredicateCondition (lambda x: x > 10, 0)
        predicate.store (test.simple_handler)

        predicate.update (10)
        predicate.update (20)
        predicate.update (-5)

        test.assert_results (False, True, False)
Beispiel #4
0
    def test_predicate_condition_2(self):
        test = NotifyTestObject()

        predicate = PredicateCondition(bool, None)
        predicate.store(test.simple_handler)

        predicate.update(False)

        test.assert_results(False)
Beispiel #5
0
    def test_predicate_condition_error_2(self):
        self.assertRaises(ZeroDivisionError,
                          lambda: PredicateCondition(lambda x: 1 / x, 0))

        predicate = PredicateCondition(lambda x: 1 / x, 10)
        self.assertRaises(ZeroDivisionError, lambda: predicate.update(0))
Beispiel #6
0
 def test_predicate_condition_error_1(self):
     self.assertRaises(TypeError, lambda: PredicateCondition(None, None))
Beispiel #7
0
    def test_predicate_condition_error_2 (self):
        self.assertRaises (ZeroDivisionError, lambda: PredicateCondition (lambda x: 1/x, 0))

        predicate = PredicateCondition (lambda x: 1/x, 10)
        self.assertRaises (ZeroDivisionError, lambda: predicate.update (0))