tests: Update for required byteorder arg for int.from_bytes()/to_bytes().

pull/2675/head
Paul Sokolovsky 2016-12-09 22:53:30 +03:00
rodzic 9d787de2a1
commit aee13ef3f2
4 zmienionych plików z 13 dodań i 2 usunięć

Wyświetl plik

@ -0,0 +1,9 @@
try:
print((10).to_bytes(1, "big"))
except Exception as e:
print(type(e))
try:
print(int.from_bytes(b"\0", "big"))
except Exception as e:
print(type(e))

Wyświetl plik

@ -0,0 +1,2 @@
<class 'NotImplementedError'>
<class 'NotImplementedError'>

Wyświetl plik

@ -14,7 +14,7 @@ desc = {
bytes = b"01"
addr = uctypes.addressof(bytes)
buf = addr.to_bytes(uctypes.sizeof(desc))
buf = addr.to_bytes(uctypes.sizeof(desc), "little")
S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.LITTLE_ENDIAN)

Wyświetl plik

@ -15,7 +15,7 @@ desc = {
bytes = b"01"
addr = uctypes.addressof(bytes)
buf = addr.to_bytes(uctypes.sizeof(desc))
buf = addr.to_bytes(uctypes.sizeof(desc), "little")
S = uctypes.struct(uctypes.addressof(buf), desc, uctypes.NATIVE)