Esempio n. 1
0
 def test_init(self):
     """Test constructor that creates object from stream."""
     stream = ['\x01', '\x00', '\x03', '\x02', '\n', '\x00']
     m = Message(stream)
     # Check properties
     self.assertEqual(m.cmd, 0x01)
     self.assertEqual(m.payload, [chr(2), chr(10), chr(0)])
     # Convert message to stream
     self.assertEqual(m.stream, stream)
Esempio n. 2
0
 def test_small_message(self):
     """Test message with stream impossibly small."""
     with self.assertRaises(SerialErrMsgShort):
         Message(['\x11', '\x00'])