tests: Improve coverage of struct with test for non-compliant behaviour.

This commit is contained in:
Damien George 2016-10-07 12:57:25 +11:00
parent dffa383b06
commit 82af4d6749
3 changed files with 9 additions and 12 deletions

View File

@ -103,15 +103,3 @@ try:
print(struct.unpack_from('<b', buf, -11))
except:
print('struct.error')
# pack with too many args, not checked by uPy
#try:
# print(struct.pack('ii', 1, 2, 3))
#except:
# print('struct.error')
# pack with too few args, not checked by uPy
#try:
# print(struct.pack('ii', 1))
#except:
# print('struct.error')

View File

@ -1,6 +1,7 @@
# tests for things that are not implemented, or have non-compliant behaviour
import array
import ustruct
# array deletion not implemented
try:
@ -87,3 +88,9 @@ try:
del [][2:3:4]
except NotImplementedError:
print('NotImplementedError')
# struct pack with too many args, not checked by uPy
print(ustruct.pack('bb', 1, 2, 3))
# struct pack with too few args, not checked by uPy
print(ustruct.pack('bb', 1))

View File

@ -12,3 +12,5 @@ NotImplementedError
NotImplementedError
NotImplementedError
NotImplementedError
b'\x01\x02'
b'\x01\x00'