summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-10-28 14:14:45 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-10-28 14:14:45 +0100
commit30b294cb6c574d9a7250c548280f8838137814d1 (patch)
treed1443d673babdc923154dda868492fdc29aca90d
parentvenv: Update mypy (diff)
downloadrtems-central-30b294cb6c574d9a7250c548280f8838137814d1.tar.bz2
items: Add Link.__setitem__()
-rw-r--r--rtemsspec/items.py3
-rw-r--r--rtemsspec/tests/test_items_item.py2
2 files changed, 5 insertions, 0 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index 84fca2a2..6e87245a 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -112,6 +112,9 @@ class Link:
def __getitem__(self, name: str) -> Any:
return self._data[name]
+ def __setitem__(self, key: str, value: Any) -> None:
+ self._data[key] = value
+
@property
def item(self) -> "Item":
""" The item referenced by this link. """
diff --git a/rtemsspec/tests/test_items_item.py b/rtemsspec/tests/test_items_item.py
index e84ce276..f2a137d5 100644
--- a/rtemsspec/tests/test_items_item.py
+++ b/rtemsspec/tests/test_items_item.py
@@ -173,6 +173,8 @@ def test_parents():
child.init_parents(item_cache)
for link in child.links_to_parents():
link.item.add_link_to_child(Link.create(link, child))
+ link["foo"] = "bar"
+ assert child["links"][0]["foo"] == "bar"
parents = [item for item in child.parents()]
assert len(parents) == 1
assert parents[0] == parent