Skip to content

Commit 82af4d6

Browse files
committed
tests: Improve coverage of struct with test for non-compliant behaviour.
1 parent dffa383 commit 82af4d6

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

tests/basics/struct1.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,3 @@
103103
print(struct.unpack_from('<b', buf, -11))
104104
except:
105105
print('struct.error')
106-
107-
# pack with too many args, not checked by uPy
108-
#try:
109-
# print(struct.pack('ii', 1, 2, 3))
110-
#except:
111-
# print('struct.error')
112-
113-
# pack with too few args, not checked by uPy
114-
#try:
115-
# print(struct.pack('ii', 1))
116-
#except:
117-
# print('struct.error')

tests/misc/non_compliant.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# tests for things that are not implemented, or have non-compliant behaviour
22

33
import array
4+
import ustruct
45

56
# array deletion not implemented
67
try:
@@ -87,3 +88,9 @@
8788
del [][2:3:4]
8889
except NotImplementedError:
8990
print('NotImplementedError')
91+
92+
# struct pack with too many args, not checked by uPy
93+
print(ustruct.pack('bb', 1, 2, 3))
94+
95+
# struct pack with too few args, not checked by uPy
96+
print(ustruct.pack('bb', 1))

tests/misc/non_compliant.py.exp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ NotImplementedError
1212
NotImplementedError
1313
NotImplementedError
1414
NotImplementedError
15+
b'\x01\x02'
16+
b'\x01\x00'

0 commit comments

Comments
 (0)