diff options
author | Inada Naoki <songofacandy@gmail.com> | 2019-01-25 20:52:57 +0900 |
---|---|---|
committer | Inada Naoki <songofacandy@gmail.com> | 2019-01-25 20:52:57 +0900 |
commit | 464fe277e1165a5870d4edc040be9c9ac1c1df0c (patch) | |
tree | 8b31a4007c926dd44300825431363c9a1c2e0709 /test/test_extension.py | |
parent | 28b5f46a34933cc177aca333203d1344b5e3639a (diff) | |
download | msgpack-python-464fe277e1165a5870d4edc040be9c9ac1c1df0c.tar.gz |
Remove pytest warnings
Diffstat (limited to 'test/test_extension.py')
-rw-r--r-- | test/test_extension.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/test_extension.py b/test/test_extension.py index d05d7ab..8aa0cbb 100644 --- a/test/test_extension.py +++ b/test/test_extension.py @@ -40,7 +40,10 @@ def test_extension_type(): print('default called', obj) if isinstance(obj, array.array): typecode = 123 # application specific typecode - data = obj.tostring() + try: + data = obj.tobytes() + except AttributeError: + data = obj.tostring() return ExtType(typecode, data) raise TypeError("Unknown type object %r" % (obj,)) @@ -48,7 +51,10 @@ def test_extension_type(): print('ext_hook called', code, data) assert code == 123 obj = array.array('d') - obj.fromstring(data) + try: + obj.frombytes(data) + except AttributeError: # PY2 + obj.fromstring(data) return obj obj = [42, b'hello', array.array('d', [1.1, 2.2, 3.3])] |