Exemplo n.º 1
0
 def check_crc_missing_crc(expect):
     with raises(framing.CRCCheckFailure):
         framing.check_crc(b'hello world')
Exemplo n.º 2
0
 def check_crc(expect):
     expect(framing.check_crc(b'hello world\xa8')) == b'hello world'
Exemplo n.º 3
0
 def check_crc_failure(expect):
     with raises(framing.CRCCheckFailure):
         framing.check_crc(b'hello world\xff')
Exemplo n.º 4
0
 def check_crc_empty_string(expect):
     expect(framing.check_crc(b'\x00')) == b''
Exemplo n.º 5
0
 def check_crc_zero_length(expect):
     with raises(framing.CRCCheckFailure):
         framing.check_crc(b'')
Exemplo n.º 6
0
 def check_crc_32bit(expect):
     expect(
         framing.check_crc(b'hello world\x85\x11J\r',
                           crc_size=CrcSize.CRC32)) == b'hello world'
Exemplo n.º 7
0
 def check_crc_16bit(expect):
     expect(framing.check_crc(b'hello world\xc19',
                              crc_size=CrcSize.CRC16)) == b'hello world'
Exemplo n.º 8
0
 def check_crc_8bit(expect):
     expect(framing.check_crc(b'hello world\xa8',
                              crc_size=CrcSize.CRC8)) == b'hello world'