def testBindToFunction(self): def thatWhichMustBeCalled(newValue): thatWhichMustBeCalled.called = True thatWhichMustBeCalled.called = False e = Entry() e.bindOnChange(thatWhichMustBeCalled) e.set('Hello World!') self.assertTrue(thatWhichMustBeCalled.called)
def testBindToMethod(self): class MethodHolder(object): def methodThatMustBeCalled(self, newValue): self.called = True e = Entry() methodHolder = MethodHolder() methodHolder.called = False e.bindOnChange(methodHolder.methodThatMustBeCalled) e.set('Hello World!') self.assertTrue(methodHolder.called)