tests/struct1: Add testcase for an unknown type char.

This commit is contained in:
Paul Sokolovsky 2016-05-14 15:54:09 +03:00
parent e53fb1bf03
commit 719f8c044a
1 changed files with 6 additions and 0 deletions

View File

@ -62,6 +62,12 @@ try:
except TypeError:
print('TypeError')
# make sure that unknown types are detected
try:
struct.pack("z", 1)
except:
print("Unknown type")
# Initially repitition counters were supported only for strings,
# but later were implemented for all.
print(struct.unpack("<3B2h", b"foo\x12\x34\xff\xff"))