Exemplo n.º 1
0
 def test_escape_method(self):
     """
     APIFrame.escape() must work as expected
     """
     test_data = APIFrame.START_BYTE
     new_data = APIFrame.escape(test_data)
     self.assertEqual(new_data, APIFrame.ESCAPE_BYTE + b'\x5e')
Exemplo n.º 2
0
 def test_escape_method(self):
     """
     APIFrame.escape() must work as expected
     """
     test_data = APIFrame.START_BYTE
     new_data = APIFrame.escape(test_data)
     self.assertEqual(new_data, APIFrame.ESCAPE_BYTE + b'\x5e')
Exemplo n.º 3
0
 def test_unescape_input2(self):
     """
     APIFrame must properly unescape escaped input
     """
     test_data = APIFrame.escape(b'\x00\x00\x00\x11\x13\x7D\x7E\x00\x00\x00')
     expected_data = b'\x00\x00\x00\x11\x13\x7D\x7E\x00\x00\x00'
     frame = APIFrame(escaped=True)
     
     for byte in [test_data[x:x+1] for x in range(0, len(test_data))]:
         frame.fill(byte)
     self.assertEqual(frame.raw_data, expected_data)