import pathlib test_file = pathlib.Path(__file__) test_dir = test_file.parent project_dir = test_dir.parent import sys sys.path.append(str(project_dir.absolute())) import source as communication def main(): message = "\ width=200\n\ height=100\n\ \n\ [first]\n\ my=iam\n\ \n\ [conn]\n\ ip=dhcp\n\ ssid=name\n\ " result = communication.decoder(message).process().result() def check(key: str, value: str, section: str | None = None) -> None: if result.get_key(key, section) == value: print("Key " + key + " work.") return section = "default" if section is None else section print("Key " + key + " in section " + section + " NOT WORK.") check("width", "200") check("height", "100") check("my", "iam", "first") check("ip", "dhcp", "conn") check("ssid", "name", "conn") if __name__ == "__main__": main()