コード例 #1
0
    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)
コード例 #2
0
    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)
コード例 #3
0
    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), ))
コード例 #4
0
    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),))