def testNoLeakingGeneratorsInMultiTransparents(self): class Responder(Observable): def message(self): return 'response' obs = Observable() t1 = Transparent() t2 = Transparent() obs.addObserver(t1) t1.addObserver(t2) t2.addObserver(Responder()) result = obs.call.message() self.assertEquals('response', result) del obs, t1, t2, result
def xxtestRelativeSpeedOfAll(self): from time import time class A(Observable): def f(self): raise StopIteration(None) yield root = Observable() connector = Transparent() root.addObserver(connector) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) t = 0.0 for _ in xrange(10000): g = compose(root.all.f()) t0 = time() for _ in g: g.next() t1 = time() t += t1 - t0 print t def f(): for _ in xrange(10000): g = compose(root.all.f()) for _ in g: g.next()
def testNoLeakingGeneratorsInMultiTransparents(self): class Responder(Observable): def message(self): return 'response' obs = Observable() t1 = Transparent() t2 = Transparent() obs.addObserver(t1) t1.addObserver(t2) t2.addObserver(Responder()) result = obs.call.message() self.assertEquals('response', result) del obs, t1, t2, result
def xxtestRelativeSpeedOfAll(self): from time import time class A(Observable): def f(self): raise StopIteration(None) yield root = Observable() connector = Transparent() root.addObserver(connector) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) connector.addObserver(A()) t = 0.0 for _ in xrange(10000): g = compose(root.all.f()) t0 = time() for _ in g: g.next() t1 = time() t += t1 - t0 print t def f(): for _ in xrange(10000): g = compose(root.all.f()) for _ in g: g.next()