def test_json(self): hdr = meterbus.TelegramHeader() hdr.load(self.frame) jd = json.loads(hdr.to_JSON()) self.assertEqual(jd['start'], "0x68") self.assertEqual(jd['stop'], "0x16") self.assertEqual(jd['length'], "0x3") self.assertEqual(jd['a'], "0xb") self.assertEqual(jd['crc'], "0xff")
def test_frame_header_setter(self): frame = meterbus.TelegramShort(self.frame) hdr = meterbus.TelegramHeader() frame.header = hdr self.assertIs(frame.header, hdr)
def test_header_length(self): hdr = meterbus.TelegramHeader() self.assertEqual(hdr.headerLengthCRCStop, 8)