def test5(self): try: print timeout_yield(exc()) self.assert_(False, "should've raised an exception") except: pass like_yield(wait(1))
def test4(self): try: print timeout_yield(g(1), timeout=.5) self.assert_(False, "should've timed out.") except TimeoutError: pass like_yield(wait(1))
def test4(self): try: print timeout_yield(g(1), timeout=.5) self.assert_(False, "should've timed out." ) except TimeoutError: pass like_yield(wait(1))
def test3(self): self.assert_(timeout_yield(g(.1), timeout=.5) == 6, "should return 6.") like_yield(wait(1))
def test2(self): self.assert_( timeout_yield(f(), timeout=1) == 5, "with specified timeout should still return 5") like_yield(wait(1))
def test1(self): self.assert_(timeout_yield(f()) == 5, "should return 5") like_yield(wait(1))
def g(t): sys.stdout.flush() like_yield(wait(t)) return 6
def test3(self): self.assert_( timeout_yield(g(.1), timeout=.5) == 6, "should return 6." ) like_yield(wait(1))
def test2(self): self.assert_(timeout_yield(f(), timeout=1) == 5, "with specified timeout should still return 5" ) like_yield(wait(1))
def test1(self): self.assert_(timeout_yield(f()) == 5, "should return 5" ) like_yield(wait(1))