def test_strange_encodings(self): for encoded, decoded in [(b'\xc0\xc0\xc0', b''), (b'\xc0\xc0\xc0text\xc0\xc0', b'text'), (b'text\xc0\xc0', b'text'), (b'\xc0\xc0\xc0text', b'text'), (b'text', b'text'), ]: self.assertEqual(decoded, slipsocket.decode(encoded))
def test_strange_encodings(self): for encoded, decoded in [ (b'\xc0\xc0\xc0', b''), (b'\xc0\xc0\xc0text\xc0\xc0', b'text'), (b'text\xc0\xc0', b'text'), (b'\xc0\xc0\xc0text', b'text'), (b'text', b'text'), ]: self.assertEqual(decoded, slipsocket.decode(encoded))
def test_encoding_decoding(self): for decoded, encoded in self.data: self.assertEqual(encoded, slipsocket.encode(decoded)) self.assertEqual(decoded, slipsocket.decode(encoded))