def test_watcher_condition_1 (self): test = NotifyTestObject () watcher = WatcherCondition () watcher.store (test.simple_handler) condition = Condition (True) watcher.watch (condition) self.assert_(watcher.watched_condition is condition) condition.state = False test.assert_results (False, True, False)
def test_watcher_condition_2(self): test = NotifyTestObject() condition1 = Condition(True) condition2 = Condition(False) condition3 = Condition(False) watcher = WatcherCondition(condition1) watcher.store(test.simple_handler) watcher.watch(condition2) watcher.watch(condition3) watcher.watch(None) self.assert_(watcher.watched_condition is None) # Last two watch() calls must not change watcher's state. test.assert_results(True, False)
def test_watcher_condition_1(self): test = NotifyTestObject() watcher = WatcherCondition() watcher.store(test.simple_handler) condition = Condition(True) watcher.watch(condition) self.assert_(watcher.watched_condition is condition) condition.state = False test.assert_results(False, True, False)
def test_watcher_condition_2 (self): test = NotifyTestObject () condition1 = Condition (True) condition2 = Condition (False) condition3 = Condition (False) watcher = WatcherCondition (condition1) watcher.store (test.simple_handler) watcher.watch (condition2) watcher.watch (condition3) watcher.watch (None) self.assert_(watcher.watched_condition is None) # Last two watch() calls must not change watcher's state. test.assert_results (True, False)
def test_watcher_condition_error_3(self): condition = Condition(True) watcher = WatcherCondition(condition) self.assertRaises(ValueError, lambda: watcher.watch(watcher)) self.assert_(watcher.watched_condition is condition)
def test_watcher_condition_error_2(self): watcher = WatcherCondition() self.assertRaises(TypeError, lambda: watcher.watch(25))
def test_watcher_condition_error_1(self): self.assertRaises(TypeError, lambda: WatcherCondition(25))
def test_watcher_condition_error_3 (self): condition = Condition (True) watcher = WatcherCondition (condition) self.assertRaises (ValueError, lambda: watcher.watch (watcher)) self.assert_ (watcher.watched_condition is condition)
def test_watcher_condition_error_2 (self): watcher = WatcherCondition () self.assertRaises (TypeError, lambda: watcher.watch (25))