Visitar URL original
better error checks by methane · Pull Request #607 · msgpack/msgpack-python · 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
fix test
  • Loading branch information
methane committed May 5, 2024
commit 04ddc1bdf69a005755f621efa18b1b0a29d1f5e0
4 changes: 3 additions & 1 deletion test/test_buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ def test_packer_getbuffer():
packer.pack_array_header(2)
packer.pack(42)
packer.pack("hello")
assert bytes(packer) == b"\x92*\xa5hello"
buffer = packer.getbuffer()
assert isinstance(buffer, memoryview)
assert bytes(buffer) == b"\x92*\xa5hello"

if Packer.__module__ == "msgpack._cmsgpack": # only for Cython
# cython Packer supports buffer protocol directly
assert bytes(packer) == b"\x92*\xa5hello"

with raises(BufferError):
packer.pack(42)
buffer.release()
Expand Down