示例#1
0
 def test_check_checksum_raises_exception_if_checksum_invalid(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         encoded_msg = simple_encoded_msg[:-4] + b"123" + settings.SOH
         DecoderApp.check_checksum(encoded_msg, 0, 19)
示例#2
0
 def test_check_checksum_not_found_raises_exception(self,
                                                    simple_encoded_msg):
     with pytest.raises(ParsingError):
         encoded_msg = simple_encoded_msg[:-7]
         DecoderApp.check_checksum(encoded_msg)
示例#3
0
 def test_check_checksum_trailing_bytes_raises_exception(
         self, simple_encoded_msg):
     with pytest.raises(ParsingError):
         message = simple_encoded_msg + b"34=1" + settings.SOH
         DecoderApp.check_checksum(message)
示例#4
0
 def test_check_checksum(self, simple_encoded_msg):
     checksum, _ = DecoderApp.check_checksum(simple_encoded_msg)
     assert checksum == 163