Packer accepts bytearray objects (#229)

This commit is contained in:
jfolz 2017-05-18 13:03:15 +02:00 committed by INADA Naoki
parent a8d9162ca6
commit f0f2c0b397
3 changed files with 23 additions and 4 deletions

View file

@ -58,6 +58,13 @@ def testPackBytes():
for td in test_data:
check(td)
def testPackByteArrays():
test_data = [
bytearray(b""), bytearray(b"abcd"), (bytearray(b"defgh"),),
]
for td in test_data:
check(td)
def testIgnoreUnicodeErrors():
re = unpackb(packb(b'abc\xeddef'), encoding='utf-8', unicode_errors='ignore', use_list=1)
assert re == "abcdef"