Skip to content
Snippets Groups Projects
Commit 82af4d67 authored by Damien George's avatar Damien George
Browse files

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

parent dffa383b
No related branches found
No related tags found
No related merge requests found
...@@ -103,15 +103,3 @@ try: ...@@ -103,15 +103,3 @@ try:
print(struct.unpack_from('<b', buf, -11)) print(struct.unpack_from('<b', buf, -11))
except: except:
print('struct.error') 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')
# tests for things that are not implemented, or have non-compliant behaviour # tests for things that are not implemented, or have non-compliant behaviour
import array import array
import ustruct
# array deletion not implemented # array deletion not implemented
try: try:
...@@ -87,3 +88,9 @@ try: ...@@ -87,3 +88,9 @@ try:
del [][2:3:4] del [][2:3:4]
except NotImplementedError: except NotImplementedError:
print('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))
...@@ -12,3 +12,5 @@ NotImplementedError ...@@ -12,3 +12,5 @@ NotImplementedError
NotImplementedError NotImplementedError
NotImplementedError NotImplementedError
NotImplementedError NotImplementedError
b'\x01\x02'
b'\x01\x00'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment