def test_immediate_closed(self):
     ch = Channel()
     ch.close()
     self.assertEqual((yield put(ch, 42)), False)
 def test_immediate_closed(self):
     ch = Channel()
     ch.close()
     self.assertEqual((yield take(ch)), CLOSED)
def identity_channel(x):
    ch = Channel(1)
    put_then_callback(ch, x, lambda ok: ch.close())
    return ch