def testCompareNotifyContext():
    """ObserverTest: Test compare_notify_context()"""
    tester = ObserverTester()
    observer = Observer(tester.observerTestMethod, tester)

    ok_(not observer.compare_notify_context(object()))
    ok_(observer.compare_notify_context(tester))
def testObserverConstructor():
    """ObserverTest: Test Observer Constructor"""
    tester = ObserverTester()
    observer = Observer(tester.observerTestMethod, tester)

    note = Notification('ObserverTestNote',5)
    observer.notify_observer(note)

    eq_(tester.observerTestVar, 5)
def testObserverAccessors():
    """ObserverTest: Test Observer Accessors"""
    observer = Observer(None,None)
    tester = ObserverTester()
    observer.set_notify_method(tester.observerTestMethod)
    observer.set_notify_context(tester)

    note = Notification('ObserverTestNote',10)
    observer.notify_observer(note)

    eq_(tester.observerTestVar, 10)