def test_default_value(self):
     ch = Channel(1)
     r = yield alts([ch], default=42)
     self.assertEqual(r.value, 42)
     self.assertEqual(r.channel, DEFAULT)
     yield put(ch, 53)
     r = yield alts([ch], default=42)
     self.assertEqual(r.value, 53)
     self.assertEqual(r.channel, ch)
 def test_no_priority(self):
     nums = range(50)
     chs = [Channel(1) for _ in nums]
     for i in nums:
         yield put(chs[i], i)
     values = []
     for _ in nums:
         values.append((yield alts(chs)).value)
     self.assertNotEqual(values, nums)
 def test_selecting_on_closed_channel(self):
     i = 0
     while i < self.limit:
         i += 1
         yield alts([self.ch, [self.ch, 1]])
 def test_identity(self):
     ch = identity_channel(42)
     r = yield alts([ch])
     self.assertEqual(r.value, 42)
     self.assertEqual(r.channel, ch)