summaryrefslogtreecommitdiff
path: root/tests/basics/struct2.py
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2017-08-25 22:17:07 -0400
committerDan Halbert <halbert@halwitz.org>2017-08-25 22:17:07 -0400
commitef61b5ecb59e9b4e37e3e3c023c62d583c23eb16 (patch)
tree45a798fbed0dc673304597b29e0b60174195ce79 /tests/basics/struct2.py
parent266be307770abe11c220eb493388807920914b7a (diff)
parent1f78e7a43130acfa4bedf16c1007a1b0f37c75c3 (diff)
Initial merge of micropython v1.9.2 into circuitpython 2.0.0 (in development) master.
cpx build compiles and loads and works in repl; test suite not run yet esp8266 not tested yet
Diffstat (limited to 'tests/basics/struct2.py')
-rw-r--r--tests/basics/struct2.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/basics/struct2.py b/tests/basics/struct2.py
index d8234d0d3..3b9dd5c1f 100644
--- a/tests/basics/struct2.py
+++ b/tests/basics/struct2.py
@@ -40,3 +40,30 @@ try:
struct.calcsize('0z')
except:
print('Exception')
+
+# check that a count without a type specifier raises an exception
+
+try:
+ struct.calcsize('1')
+except:
+ print('Exception')
+
+try:
+ struct.pack('1')
+except:
+ print('Exception')
+
+try:
+ struct.pack_into('1', bytearray(4), 0, 'xx')
+except:
+ print('Exception')
+
+try:
+ struct.unpack('1', 'xx')
+except:
+ print('Exception')
+
+try:
+ struct.unpack_from('1', 'xx')
+except:
+ print('Exception')