tests: Split byteorder-dependent tests to *_endian.py's.

modjni
Paul Sokolovsky 2015-08-30 00:30:28 +03:00
parent 0a8b5d160b
commit 58d9b10d70
8 changed files with 31 additions and 6 deletions

View File

@ -7,7 +7,7 @@ print(array('b', (1, 2)))
print(array('h', [1, 2]))
# raw copy from bytes, bytearray
print(array('h', b'12'))
print(array('h', b'22')) # should be byteorder-neutral
print(array('h', bytearray(2)))
print(array('i', bytearray(4)))

View File

@ -0,0 +1,6 @@
# test construction of array.array from different objects
from array import array
# raw copy from bytes, bytearray
print(array('h', b'12'))

View File

@ -9,5 +9,4 @@ print(bytearray([1, 2]))
# arrays
print(bytearray(array('b', [1, 2])))
print(bytearray(array('h', [1, 2])))
print(bytearray(array('I', [1, 2])))
print(bytearray(array('h', [0x101, 0x202])))

View File

@ -0,0 +1,7 @@
# test construction of bytearray from different objects
from array import array
# arrays
print(bytearray(array('h', [1, 2])))
print(bytearray(array('I', [1, 2])))

View File

@ -5,5 +5,7 @@ print(b"123" + bytearray(2))
import array
print(b"123" + array.array('i', [1]))
# should be byteorder-neutral
print(b"123" + array.array('h', [0x1515]))
print(b"\x01\x02" + array.array('b', [1, 2]))

View File

@ -0,0 +1,5 @@
# test bytes + other
import array
print(b"123" + array.array('i', [1]))

View File

@ -9,8 +9,7 @@ print(bytes(bytearray(4)))
# arrays
print(bytes(array('b', [1, 2])))
print(bytes(array('h', [1, 2])))
print(bytes(array('I', [1, 2])))
print(bytes(array('h', [0x101, 0x202])))
# long ints
print(ord(bytes([14953042807679334000 & 0xff])))

View File

@ -0,0 +1,7 @@
# test construction of bytes from different objects
from array import array
# arrays
print(bytes(array('h', [1, 2])))
print(bytes(array('I', [1, 2])))