def test_NodeSpecificCANMessage(self): p = canfix.NodeSpecific() p.sendNode = 23 p.controlCode = 0xFF m = p.msg self.assertEqual(m.arbitration_id, 0x6E0 + 23) self.assertEqual(m.data, bytearray([0xFF]))
def test_NodeSpecificCANMessageWithData(self): p = canfix.NodeSpecific() p.sendNode = 23 p.controlCode = 0xFF p.data = bytearray([0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]) m = p.msg self.assertEqual(m.arbitration_id, 0x6E0 + 23) self.assertEqual( m.data, bytearray([0xFF, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]))
def test_NodeSpecificCANMessageNodeNotSet2(self): p = canfix.NodeSpecific() #p.sendNode = 23 p.controlCode = 0xFF with self.assertRaises(AttributeError): m = p.msg