예제 #1
0
    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)
예제 #2
0
    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)
예제 #3
0
    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)
예제 #4
0
    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)