Esempio n. 1
0
 def test_send_exception(self):
     s = proc.Source()
     q1, q2, q3 = coros.queue(), coros.queue(), coros.queue()
     s.link_exception(q1)
     s.send_exception(OSError('hello'))
     sleep(0)
     assert q1.ready()
     s.link_value(q2)
     s.link(q3)
     assert not q2.ready()
     sleep(0)
     assert q3.ready()
     self.assertRaises(OSError, q1.wait)
     self.assertRaises(OSError, q3.wait)
     self.assertRaises(OSError, s.wait)
Esempio n. 2
0
 def test_send(self):
     s = proc.Source()
     q1, q2, q3 = coros.queue(), coros.queue(), coros.queue()
     s.link_value(q1)
     self.assertRaises(Timeout, s.wait, 0)
     assert s.wait(0, None) is None
     assert s.wait(0.001, None) is None
     self.assertRaises(Timeout, s.wait, 0.001)
     s.send(1)
     assert not q1.ready()
     assert s.wait() == 1
     sleep(0)
     assert q1.ready()
     s.link_exception(q2)
     s.link(q3)
     assert not q2.ready()
     sleep(0)
     assert q3.ready()
     assert s.wait() == 1
Esempio n. 3
0
 def test_multiple_listeners_error_unlink_Source(self):
     p = proc.Source()
     proc.spawn(p.send, 6)
     self._test_multiple_listeners_error_unlink(p)