tests: Add new tests for ubinascii differences
.. some of these tests currently fail, but a subsequent commit will fix them.
This commit is contained in:
parent
dd0f8689a1
commit
e7f463320f
@ -28,6 +28,9 @@ print(binascii.a2b_base64(b'Zm9v=='))
|
||||
print(binascii.a2b_base64(b'Zm9v==='))
|
||||
print(binascii.a2b_base64(b'Zm9v===YmFy'))
|
||||
|
||||
# Unicode strings can be decoded
|
||||
print(binascii.a2b_base64(u'Zm9v===YmFy'))
|
||||
|
||||
try:
|
||||
print(binascii.a2b_base64(b'abc'))
|
||||
except ValueError:
|
||||
|
@ -20,3 +20,7 @@ print(binascii.b2a_base64(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'))
|
||||
print(binascii.b2a_base64(b'\x7f\x80\xff'))
|
||||
print(binascii.b2a_base64(b'1234ABCDabcd'))
|
||||
print(binascii.b2a_base64(b'\x00\x00>')) # convert into '+'
|
||||
try:
|
||||
print(binascii.b2a_base64(''))
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
|
@ -22,3 +22,7 @@ print(hex(binascii.crc32(b' over the lazy dog', binascii.crc32(b'The quick brown
|
||||
print(hex(binascii.crc32(b'\x00' * 16, binascii.crc32(b'\x00' * 16))))
|
||||
print(hex(binascii.crc32(b'\xff' * 16, binascii.crc32(b'\xff' * 16))))
|
||||
print(hex(binascii.crc32(bytes(range(16, 32)), binascii.crc32(bytes(range(16))))))
|
||||
try:
|
||||
binascii.crc32('')
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
|
@ -11,3 +11,7 @@ print(binascii.hexlify(b'\x00\x01\x02\x03\x04\x05\x06\x07'))
|
||||
print(binascii.hexlify(b'\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f'))
|
||||
print(binascii.hexlify(b'\x7f\x80\xff'))
|
||||
print(binascii.hexlify(b'1234ABCDabcd'))
|
||||
try:
|
||||
binascii.hexlify('')
|
||||
except TypeError:
|
||||
print("TypeError")
|
||||
|
@ -12,6 +12,9 @@ print(binascii.unhexlify(b'08090a0b0c0d0e0f'))
|
||||
print(binascii.unhexlify(b'7f80ff'))
|
||||
print(binascii.unhexlify(b'313233344142434461626364'))
|
||||
|
||||
# Unicode strings can be decoded
|
||||
print(binascii.unhexlify('313233344142434461626364'))
|
||||
|
||||
try:
|
||||
a = binascii.unhexlify(b'0') # odd buffer length
|
||||
except ValueError:
|
||||
|
Loading…
x
Reference in New Issue
Block a user