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