def test_watchObjectConstructedInstanceMethod(self): """ L{CRUFT_WatchyThingie.watchingfoo} adds a C{_watchEmitChanged} attribute which refers to a bound method on the instance passed to it. """ foo = Foo() cwt = CRUFT_WatchyThingie() cwt.watchObject(foo, 'id', 'cback') # check new constructed instance method self.assertIdentical(foo._watchEmitChanged.im_self, foo)
def test_watchObjectConstructedClass(self): """ L{CRUFT_WatchyThingie.watchObject} changes the class of its first argument to a custom watching class. """ foo = Foo() cwt = CRUFT_WatchyThingie() cwt.watchObject(foo, 'id', 'cback') # check new constructed class newClassName = foo.__class__.__name__ self.assertEqual(newClassName, "WatchingFoo%X" % (id(foo), ))
def test_watchObjectConstructedClass(self): """ L{CRUFT_WatchyThingie.watchObject} changes the class of its first argument to a custom watching class. """ foo = Foo() cwt = CRUFT_WatchyThingie() cwt.watchObject(foo, 'id', 'cback') # check new constructed class newClassName = foo.__class__.__name__ self.assertEqual(newClassName, "WatchingFoo%X" % (id(foo),))