def testProtocolConversion(self): # b1 = tobytestr("abc\n") b2 = bytearray([1, 2, 3, 255, 0, 128, 127]) # encoded1 = encode_bytearray(b1) encoded2 = encode_bytearray(b2) # self.assertEqual(b1, decode_bytearray(encoded1)) self.assertEqual(b2, decode_bytearray(encoded2))