def check_crc_missing_crc(expect): with raises(framing.CRCCheckFailure): framing.check_crc(b'hello world')
def check_crc(expect): expect(framing.check_crc(b'hello world\xa8')) == b'hello world'
def check_crc_failure(expect): with raises(framing.CRCCheckFailure): framing.check_crc(b'hello world\xff')
def check_crc_empty_string(expect): expect(framing.check_crc(b'\x00')) == b''
def check_crc_zero_length(expect): with raises(framing.CRCCheckFailure): framing.check_crc(b'')
def check_crc_32bit(expect): expect( framing.check_crc(b'hello world\x85\x11J\r', crc_size=CrcSize.CRC32)) == b'hello world'
def check_crc_16bit(expect): expect(framing.check_crc(b'hello world\xc19', crc_size=CrcSize.CRC16)) == b'hello world'
def check_crc_8bit(expect): expect(framing.check_crc(b'hello world\xa8', crc_size=CrcSize.CRC8)) == b'hello world'