def test_decode_message(self): msg = f('{STX}1A|B|C|D{CR}{ETX}BF{CRLF}') res = (1, [['A', 'B', 'C', 'D']], 'BF') self.assertEqual(res, codec.decode_message(msg, 'ascii'))
def test_encode_message(self): msg = f('{STX}1A|B|C|D{CR}{ETX}BF{CRLF}') seq, data, cs = codec.decode_message(msg, 'ascii') self.assertEqual(msg, codec.encode_message(seq, data, 'ascii'))
def test_decode_message(self): msg = f("{STX}1A|B|C|D{CR}{ETX}BF{CRLF}") res = (1, [["A", "B", "C", "D"]], "BF") self.assertEqual(res, codec.decode_message(msg, "ascii"))
def test_encode_message(self): msg = f("{STX}1A|B|C|D{CR}{ETX}BF{CRLF}") seq, data, cs = codec.decode_message(msg, "ascii") self.assertEqual(msg, codec.encode_message(seq, data, "ascii"))
def dispatcher(message): codec.decode_message(message, 'latin-1')