def test_str(self): from QGIS_FMV.klvdata.element import UnknownElement self.assertEqual( str(UnknownElement(b"\x02", b"\x00\x04\x60\x50\x58\x4E\x01\x80")), "UnknownElement: (b'\\x02', 8, b'\\x00\\x04`PXN\\x01\\x80')", )
def test_name(self): from QGIS_FMV.klvdata.element import UnknownElement self.assertEqual( UnknownElement(b"\x02", b"\x00\x04\x60\x50\x58\x4E\x01\x80").name, "UnknownElement", )
def test_packet(self): from QGIS_FMV.klvdata.element import UnknownElement self.assertEqual( bytes(UnknownElement(b"\x02", b"\x00\x04\x60\x50\x58\x4E\x01\x80")), b"\x02\x08\x00\x04\x60\x50\x58\x4E\x01\x80", )
def test_repr(self): from QGIS_FMV.klvdata.element import UnknownElement self.assertIsInstance( ast.literal_eval( repr( UnknownElement(b'\x02', b'\x00\x04\x60\x50\x58\x4E\x01\x80'))), UnknownElement)
def __next__(self): key, value = next(self.iter_stream) if key in self.parsers: return self.parsers[key](value) else: # Even if KLV is not known, make best effort to parse and preserve. # Element is an abstract super class, do not create instances on # Element. return UnknownElement(key, value)
def __next__(self): key, value = next(self.iter_stream) # qgsu.showUserAndLogMessage( # "", "Streamparser key: " + str(key) + " value: " + str(value), onlyLog=True) if key in self.parsers: return self.parsers[key](value) else: # Even if KLV is not known, make best effort to parse and preserve. # Element is an abstract super class, do not create instances on # Element. return UnknownElement(key, value)
def test_value(self): from QGIS_FMV.klvdata.element import UnknownElement self.assertEqual( UnknownElement(b'\x02', b'\x00\x04\x60\x50\x58\x4E\x01\x80').value, b'\x00\x04\x60\x50\x58\x4E\x01\x80')
def test_length(self): from QGIS_FMV.klvdata.element import UnknownElement self.assertEqual( UnknownElement(b"\x02", b"\x00\x04\x60\x50\x58\x4E\x01\x80").length, b"\x08" )