Use new msgpack spec by default. (#386)

This commit is contained in:
Inada Naoki 2019-12-05 21:34:10 +09:00 committed by GitHub
parent de320488ae
commit 7e9905bdfa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 75 additions and 126 deletions

View file

@ -1,13 +1,12 @@
#!/usr/bin/env python
# coding: utf-8
from msgpack import packb, unpackb
def check(length, obj):
v = packb(obj)
def check(length, obj, use_bin_type=True):
v = packb(obj, use_bin_type=use_bin_type)
assert len(v) == length, "%r length should be %r but get %r" % (obj, length, len(v))
assert unpackb(v, use_list=0) == obj
assert unpackb(v, use_list=0, raw=not use_bin_type) == obj
def test_1():
@ -56,7 +55,7 @@ def test_9():
def check_raw(overhead, num):
check(num + overhead, b" " * num)
check(num + overhead, b" " * num, use_bin_type=False)
def test_fixraw():
@ -135,4 +134,4 @@ def test_match():
def test_unicode():
assert unpackb(packb("foobar"), use_list=1) == b"foobar"
assert unpackb(packb(u"foobar"), use_list=1) == u"foobar"