mirror of
https://github.com/msgpack/msgpack-python.git
synced 2026-02-11 04:10:10 +00:00
Remove encoding/unicode_errors options from Packer (#378)
This commit is contained in:
parent
cc3a8665d6
commit
e1ed0044bf
3 changed files with 9 additions and 93 deletions
|
|
@ -40,21 +40,6 @@ def testPackUnicode():
|
|||
re = Unpacker(BytesIO(data), raw=False, use_list=1).unpack()
|
||||
assert re == td
|
||||
|
||||
def testPackUTF32(): # deprecated
|
||||
try:
|
||||
test_data = [
|
||||
"",
|
||||
"abcd",
|
||||
["defgh"],
|
||||
"Русский текст",
|
||||
]
|
||||
for td in test_data:
|
||||
with pytest.deprecated_call():
|
||||
re = unpackb(packb(td, encoding='utf-32'), use_list=1, encoding='utf-32')
|
||||
assert re == td
|
||||
except LookupError as e:
|
||||
xfail(e)
|
||||
|
||||
def testPackBytes():
|
||||
test_data = [
|
||||
b"", b"abcd", (b"defgh",),
|
||||
|
|
@ -69,26 +54,11 @@ def testPackByteArrays():
|
|||
for td in test_data:
|
||||
check(td)
|
||||
|
||||
def testIgnoreUnicodeErrors(): # deprecated
|
||||
with pytest.deprecated_call():
|
||||
re = unpackb(packb(b'abc\xeddef'), encoding='utf-8', unicode_errors='ignore', use_list=1)
|
||||
assert re == "abcdef"
|
||||
|
||||
def testStrictUnicodeUnpack():
|
||||
packed = packb(b'abc\xeddef')
|
||||
with pytest.raises(UnicodeDecodeError):
|
||||
unpackb(packed, raw=False, use_list=1)
|
||||
|
||||
def testStrictUnicodePack(): # deprecated
|
||||
with raises(UnicodeEncodeError):
|
||||
with pytest.deprecated_call():
|
||||
packb("abc\xeddef", encoding='ascii', unicode_errors='strict')
|
||||
|
||||
def testIgnoreErrorsPack(): # deprecated
|
||||
with pytest.deprecated_call():
|
||||
re = unpackb(packb("abcФФФdef", encoding='ascii', unicode_errors='ignore'), raw=False, use_list=1)
|
||||
assert re == "abcdef"
|
||||
|
||||
def testDecodeBinary():
|
||||
re = unpackb(packb(b"abc"), encoding=None, use_list=1)
|
||||
assert re == b"abc"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue