示例#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_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)
示例#3
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)
示例#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)
示例#5
0
    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)
示例#6
0
 def test_watcher_condition_error_2(self):
     watcher = WatcherCondition()
     self.assertRaises(TypeError, lambda: watcher.watch(25))
示例#7
0
 def test_watcher_condition_error_1(self):
     self.assertRaises(TypeError, lambda: WatcherCondition(25))
示例#8
0
    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)
示例#9
0
 def test_watcher_condition_error_2 (self):
     watcher = WatcherCondition ()
     self.assertRaises (TypeError, lambda: watcher.watch (25))