The following test has an odd number of hex characters (I spaced it out and added comments for clarity):
def testOneFrameReceivedExactlyWithData(self):
self.gc = PhysicalLayerMock()
self.gc.registerFrameReceivedListener(self.receiveListener,
enable_test=True)
bytes = bytearray([
0x3a, 0x58, # : X
0x31, 0x39, 0x31, 0x42, 0x30, 0x33, 0x36, 0x35,
0x4e, # N (ends header)
0x30, 0x32, 0x30, 0x31, 0x31, 0x32,
0x46, 0x45, 0x30, 0x35, 0x36, 0x43,
GC_END_BYTE])
# :X19170365N020112FE056C;
self.gc.handleData(bytes)
self.assertEqual(
self.receivedFrames[0],
CanFrame(0x191B0365,
bytearray([0x02, 0x01, 0x12, 0xFE, 0x05, 0x6C]))
)
:edit: GC_END_BYTE abov is ";" not "C", my handleData was off by one (This issue is invalid)
The following test has an odd number of hex characters (I spaced it out and added comments for clarity):
Should this packet be considered valid?
:edit: GC_END_BYTE abov is ";" not "C", my handleData was off by one (This issue is invalid)