Skip to content

Commit f42dd91

Browse files
committed
Fix type signature of _get_private_objects
1 parent f6b7c5c commit f42dd91

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

khard/carddav_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,9 @@ def __init__(self, vcard: vobject.base.Component,
906906
# getters and setters
907907
#####################
908908

909-
def _get_private_objects(self) -> Dict[str, List[str]]:
909+
def _get_private_objects(self) -> Dict[str, List[Union[str, Dict[str, str]]]]:
910910
supported = [x.lower() for x in self.supported_private_objects]
911-
private_objects: Dict[str, List[str]] = {}
911+
private_objects: Dict[str, List[Union[str, Dict[str, str]]]] = {}
912912
for child in self.vcard.getChildren():
913913
lower = child.name.lower()
914914
if lower.startswith("x-") and lower[2:] in supported:

test/test_yaml_editable.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,15 @@ def test_unsupported_private_objects_can_be_added_but_not_retrieved(self) -> Non
8383
ye._add_private_object("bar", "foo")
8484
self.assertEqual(ye._get_private_objects(), {"foo": ["bar"]})
8585
self.assertIn("X-BAR:foo", ye.vcard.serialize())
86+
87+
def test_private_objects_can_have_an_ablabel(self) -> None:
88+
ye = TestYAMLEditable()
89+
ye.supported_private_objects = ["foo"]
90+
foo = ye.vcard.add("X-FOO")
91+
foo.value = "bar"
92+
foo.group = "1"
93+
label = ye.vcard.add("X-ABLABEL")
94+
label.value = "baz"
95+
label.group = "1"
96+
result = ye._get_private_objects()
97+
self.assertEqual(result, {"foo": [{"baz": "bar"}]})

0 commit comments

Comments
 (0)