Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Update test_shareable.
  • Loading branch information
ericsnowcurrently committed Jul 10, 2024
commit 6211fb29bb3c7d7d97eab6880e7b8e35072ff2d2
18 changes: 18 additions & 0 deletions Lib/test/test_interpreters/test_channels.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def test_list_all(self):
self.assertEqual(after, created)

def test_shareable(self):
interp = interpreters.create()
rch, sch = channels.create()

self.assertTrue(
Expand All @@ -60,8 +61,25 @@ def test_shareable(self):
rch2 = rch.recv()
sch2 = rch.recv()

interp.prepare_main(rch=rch, sch=sch)
sch.send_nowait(rch)
sch.send_nowait(sch)
interp.exec(dedent("""
rch2 = rch.recv()
sch2 = rch.recv()
assert rch2 == rch
assert sch2 == sch

sch.send_nowait(rch2)
sch.send_nowait(sch2)
"""))
rch3 = rch.recv()
sch3 = rch.recv()

self.assertEqual(rch2, rch)
self.assertEqual(sch2, sch)
self.assertEqual(rch3, rch)
self.assertEqual(sch3, sch)

def test_is_closed(self):
rch, sch = channels.create()
Expand Down