circuitpython/tests/cpydiff/modules_struct_whitespace_in_format.py
Tom McDermott c1f74b3005 docs/library: Warn that ustruct doesn't handle spaces in format strings.
And also add a test to capture the CPython difference.
2021-07-06 14:59:50 +10:00

14 lines
348 B
Python

"""
categories: Modules,struct
description: Struct pack with whitespace in format, whitespace ignored by CPython, error on uPy
cause: MicroPython is optimised for code size.
workaround: Don't use spaces in format strings.
"""
import struct
try:
print(struct.pack('b b', 1, 2))
print('Should have worked')
except:
print('struct.error')