def test_yield_lock(self): # Ensure we catch a "with (yield lock)", which should be # "with (yield lock.acquire())". with self.assertRaises(gen.BadYieldError): with (yield locks.Lock()): pass