mirror of
https://github.com/msgpack/msgpack-python.git
synced 2025-10-20 04:13:16 +00:00
Remove pytest warnings
This commit is contained in:
parent
28b5f46a34
commit
464fe277e1
3 changed files with 27 additions and 11 deletions
|
@ -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])]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue