Visitar URL original
gh-99941: asyncio.Protocol.data_received now received immutable bytes by DarioDaF · Pull Request #100053 · python/cpython · GitHub
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
Prev Previous commit
Next Next commit
Added test case for #99941
  • Loading branch information
DarioDaF committed Dec 6, 2022
commit 1a5af35f3667d5961869662e08f882fe9c3f0e95
5 changes: 4 additions & 1 deletion Lib/test/test_asyncio/test_proactor_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ def test_loop_reading_data(self):
called_buf = bytearray(self.buffer_size)
called_buf[:len(buf)] = buf
self.loop._proactor.recv_into.assert_called_with(self.sock, called_buf)
self.protocol.data_received.assert_called_with(bytearray(buf))
self.protocol.data_received.assert_called_with(buf)
# assert_called_with maps bytearray and bytes to the same thing so check manually
# regression test for https://github.com/python/cpython/issues/99941
self.assertIsInstance(self.protocol.data_received.call_args.args[0], bytes)

@unittest.skipIf(sys.flags.optimize, "Assertions are disabled in optimized mode")
def test_loop_reading_no_data(self):
Expand Down