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

Method test_shareable

Lib/test/test_interpreters/test_channels.py:56–88  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

54 self.assertEqual(set(channels.list_all()), set(created))
55
56 def test_shareable(self):
57 interp = interpreters.create()
58 rch, sch = channels.create()
59
60 self.assertTrue(
61 interpreters.is_shareable(rch))
62 self.assertTrue(
63 interpreters.is_shareable(sch))
64
65 sch.send_nowait(rch)
66 sch.send_nowait(sch)
67 rch2 = rch.recv()
68 sch2 = rch.recv()
69
70 interp.prepare_main(rch=rch, sch=sch)
71 sch.send_nowait(rch)
72 sch.send_nowait(sch)
73 interp.exec(dedent("""
74 rch2 = rch.recv()
75 sch2 = rch.recv()
76 assert rch2 == rch
77 assert sch2 == sch
78
79 sch.send_nowait(rch2)
80 sch.send_nowait(sch2)
81 """))
82 rch3 = rch.recv()
83 sch3 = rch.recv()
84
85 self.assertEqual(rch2, rch)
86 self.assertEqual(sch2, sch)
87 self.assertEqual(rch3, rch)
88 self.assertEqual(sch3, sch)
89
90 def test_is_closed(self):
91 rch, sch = channels.create()

Callers

nothing calls this directly

Calls 8

dedentFunction · 0.90
assertTrueMethod · 0.80
send_nowaitMethod · 0.80
prepare_mainMethod · 0.80
execMethod · 0.80
createMethod · 0.45
recvMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected