def test_predicate_condition_2 (self): test = NotifyTestObject () predicate = PredicateCondition (bool, None) predicate.store (test.simple_handler) predicate.update (False) test.assert_results (False)
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)
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)
def test_predicate_condition_2(self): test = NotifyTestObject() predicate = PredicateCondition(bool, None) predicate.store(test.simple_handler) predicate.update(False) test.assert_results(False)
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))
def test_predicate_condition_error_1(self): self.assertRaises(TypeError, lambda: PredicateCondition(None, None))
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))