tests: Add tests to improve coverage of objarray.c.

pull/2203/merge
Rami Ali 2016-12-21 17:51:42 +11:00 zatwierdzone przez Damien George
rodzic 531c206e8b
commit 1731868ae7
3 zmienionych plików z 14 dodań i 0 usunięć

Wyświetl plik

@ -28,6 +28,7 @@ print(list(m[1:-1]))
# this tests get_buffer of memoryview
m = memoryview(bytearray(2))
print(bytearray(m))
print(list(memoryview(memoryview(b'1234')))) # read-only memoryview
import array
a = array.array('i', [1, 2, 3, 4])
@ -78,3 +79,9 @@ try:
m4[1:3] = m2[1:3]
except ValueError:
print("ValueError")
# invalid assignment on RHS
try:
memoryview(array.array('i'))[0:2] = b'1234'
except ValueError:
print('ValueError')

Wyświetl plik

@ -118,3 +118,9 @@ print(ustruct.pack('bb', 1, 2, 3))
# struct pack with too few args, not checked by uPy
print(ustruct.pack('bb', 1))
# array slice assignment with unsupported RHS
try:
bytearray(4)[0:1] = [1, 2]
except NotImplementedError:
print('NotImplementedError')

Wyświetl plik

@ -18,3 +18,4 @@ NotImplementedError
NotImplementedError
b'\x01\x02'
b'\x01\x00'
NotImplementedError