Skip to content

Commit 07a35ed

Browse files
authored
Merge pull request #5 from nigl/dev
use all objects in xml dicts
2 parents afaa36a + af630e8 commit 07a35ed

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

custom_components/eta/api.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def evaluate_xml_dict(self, xml_dict, uri_dict, prefix=""):
4040
if "object" in xml_dict:
4141
child = xml_dict["object"]
4242
new_prefix = f"{prefix}_{xml_dict['@name']}"
43+
# add parent to uri_dict and evaluate childs then
44+
uri_dict[f"{prefix}_{xml_dict['@name']}"] = xml_dict["@uri"]
4345
self.evaluate_xml_dict(child, uri_dict, new_prefix)
4446
else:
4547
uri_dict[f"{prefix}_{xml_dict['@name']}"] = xml_dict["@uri"]

tests/test_api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def test_get_all_childs():
9393
uri_dict = {}
9494
eta.evaluate_xml_dict(xmltodict.parse(menu_txt)["eta"]["menu"]["fub"], uri_dict)
9595
assert type(uri_dict) == dict
96-
assert len(uri_dict) == 97
96+
assert len(uri_dict) == 123
9797

9898

9999
def test_build_uri():

0 commit comments

Comments
 (0)