diff --git a/pylgbst/utilities.py b/pylgbst/utilities.py index 4031576..0f5a7fe 100644 --- a/pylgbst/utilities.py +++ b/pylgbst/utilities.py @@ -20,13 +20,8 @@ queue = queue # just to use it def check_unpack(seq, index, pattern, size): """Check that we got size bytes, if so, unpack using pattern""" data = seq[index: index + size] - if len(data) == size: - return unpack(pattern, data)[0] - else: - log.warning( - "Unpacking of %s bytes failed, insufficient data: %r", size, seq[index:] - ) - raise ValueError(data, "Expected %s bytes" % (size,)) + assert len(data) == size, "Unexpected data len %d, expected %d" % (len(data), size) + return unpack(pattern, data)[0] def usbyte(seq, index):