fallback: Remove old buffer protocol support (#384)

This commit is contained in:
Inada Naoki 2019-12-05 20:47:20 +09:00 committed by GitHub
parent 9f4b2d53b7
commit de320488ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 19 deletions

View file

@ -1,17 +1,17 @@
#!/usr/bin/env python
# coding: utf-8
import sys
import pytest
from msgpack import packb, unpackb
@pytest.mark.skipif(sys.version_info[0] == 2, reason="Python 2 is not supported")
def test_unpack_buffer():
from array import array
buf = array("b")
try:
buf.frombytes(packb((b"foo", b"bar")))
except AttributeError: # PY2
buf.fromstring(packb((b"foo", b"bar")))
buf.frombytes(packb((b"foo", b"bar")))
obj = unpackb(buf, use_list=1)
assert [b"foo", b"bar"] == obj