MCPcopy Index your code
hub / github.com/python/cpython / test_recv_default

Method test_recv_default

Lib/test/test__interpchannels.py:761–780  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

759 _channels.recv(cid)
760
761 def test_recv_default(self):
762 default = object()
763 cid = _channels.create(REPLACE)
764 obj1 = recv_nowait(cid, default)
765 _channels.send(cid, None, blocking=False)
766 _channels.send(cid, 1, blocking=False)
767 _channels.send(cid, b'spam', blocking=False)
768 _channels.send(cid, b'eggs', blocking=False)
769 obj2 = recv_nowait(cid, default)
770 obj3 = recv_nowait(cid, default)
771 obj4 = recv_nowait(cid)
772 obj5 = recv_nowait(cid, default)
773 obj6 = recv_nowait(cid, default)
774
775 self.assertIs(obj1, default)
776 self.assertIs(obj2, None)
777 self.assertEqual(obj3, 1)
778 self.assertEqual(obj4, b'spam')
779 self.assertEqual(obj5, b'eggs')
780 self.assertIs(obj6, default)
781
782 def test_recv_sending_interp_destroyed(self):
783 with self.subTest('closed'):

Callers

nothing calls this directly

Calls 5

recv_nowaitFunction · 0.85
createMethod · 0.45
sendMethod · 0.45
assertIsMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected