def testReceiveObserved(self): # Create an object in Objective-C, add an observer and then # pass the object to Python. Unless we take special care the # Python wrapper will have the wrong type (that of the # internal helper class). observer = PyObjCTestObserver.alloc().init() o = STUB.createObservedOfClass_observer_keyPath_( NSObject, observer, u"observationInfo") try: self.assert_(isinstance(o, NSObject)) finally: o.removeObserver_forKeyPath_(observer, u"observationInfo")
def testReceiveObserved(self): # Create an object in Objective-C, add an observer and then # pass the object to Python. Unless we take special care the # Python wrapper will have the wrong type (that of the # internal helper class). # # NOTE: This test is known to fail on OSX 10.5 due to the way # KVO is implemented there. observer = PyObjCTestObserver.alloc().init() o = STUB.createObservedOfClass_observer_keyPath_( NSObject, observer, u"observationInfo") try: self.assertIsInstance(o, NSObject) finally: o.removeObserver_forKeyPath_(observer, u"observationInfo")