From 98c0b4f986aa862b843c535fef088e63fef2247c Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Mon, 28 Oct 2019 17:40:19 +0100 Subject: [PATCH] Revert "Use newer API to prevent deprecation warning" This reverts commit 84fc518e12b1bdaf99d9abdf017ee19d53b048b5. --- srsly/tests/msgpack/test_buffer.py | 2 +- srsly/tests/msgpack/test_extension.py | 4 ++-- srsly/tests/msgpack/test_memoryview.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/srsly/tests/msgpack/test_buffer.py b/srsly/tests/msgpack/test_buffer.py index 2a00e91..2853cc6 100644 --- a/srsly/tests/msgpack/test_buffer.py +++ b/srsly/tests/msgpack/test_buffer.py @@ -7,7 +7,7 @@ def test_unpack_buffer(): from array import array buf = array('b') - buf.frombytes(packb((b'foo', b'bar'))) + buf.fromstring(packb((b'foo', b'bar'))) obj = unpackb(buf, use_list=1) assert [b'foo', b'bar'] == obj diff --git a/srsly/tests/msgpack/test_extension.py b/srsly/tests/msgpack/test_extension.py index cb91a8e..58d3ed2 100644 --- a/srsly/tests/msgpack/test_extension.py +++ b/srsly/tests/msgpack/test_extension.py @@ -40,7 +40,7 @@ def default(obj): print('default called', obj) if isinstance(obj, array.array): typecode = 123 # application specific typecode - data = obj.tobytes() + data = obj.tostring() return ExtType(typecode, data) raise TypeError("Unknown type object %r" % (obj,)) @@ -48,7 +48,7 @@ def ext_hook(code, data): print('ext_hook called', code, data) assert code == 123 obj = array.array('d') - obj.frombytes(data) + obj.fromstring(data) return obj obj = [42, b'hello', array.array('d', [1.1, 2.2, 3.3])] diff --git a/srsly/tests/msgpack/test_memoryview.py b/srsly/tests/msgpack/test_memoryview.py index 440ef13..3da0485 100644 --- a/srsly/tests/msgpack/test_memoryview.py +++ b/srsly/tests/msgpack/test_memoryview.py @@ -19,7 +19,7 @@ def make_array(f, data): return a def get_data(a): - return a.tobytes() + return a.tostring() else: make_memoryview = memoryview