tests: Split byteorder-dependent tests to *_endian.py's.
This commit is contained in:
parent
0a8b5d160b
commit
58d9b10d70
@ -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)))
|
||||
|
||||
|
6
tests/basics/array_construct_endian.py
Normal file
6
tests/basics/array_construct_endian.py
Normal 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'))
|
@ -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])))
|
||||
|
7
tests/basics/bytearray_construct_endian.py
Normal file
7
tests/basics/bytearray_construct_endian.py
Normal 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])))
|
@ -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]))
|
||||
|
5
tests/basics/bytes_add_endian.py
Normal file
5
tests/basics/bytes_add_endian.py
Normal file
@ -0,0 +1,5 @@
|
||||
# test bytes + other
|
||||
|
||||
import array
|
||||
|
||||
print(b"123" + array.array('i', [1]))
|
@ -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])))
|
||||
|
7
tests/basics/bytes_construct_endian.py
Normal file
7
tests/basics/bytes_construct_endian.py
Normal 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])))
|
Loading…
x
Reference in New Issue
Block a user