diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-05-10 10:30:52 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2023-06-14 13:58:42 +0200 |
commit | 356edbfca90028ef5aef1cc4b0c2d45fb1130f31 (patch) | |
tree | 26704420a30ec6afea1532dce8658b50e7df559b /rtemsspec | |
parent | 697e33618fd8b6122370f33322d26b6af7dbd7d1 (diff) |
items: Add link_is_enabled()
Diffstat (limited to 'rtemsspec')
-rw-r--r-- | rtemsspec/items.py | 5 | ||||
-rw-r--r-- | rtemsspec/tests/test_items_item.py | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py index 5a4109c7..7ae07ab4 100644 --- a/rtemsspec/items.py +++ b/rtemsspec/items.py @@ -197,6 +197,11 @@ def _is_link_enabled(link: Link) -> bool: return link.item._data["_enabled"] # pylint: disable=protected-access +def link_is_enabled(_link: Link) -> bool: + """ Returns true. """ + return True + + class Item: """ Objects of this class represent a specification item. """ diff --git a/rtemsspec/tests/test_items_item.py b/rtemsspec/tests/test_items_item.py index 9a119891..1b4dd9f4 100644 --- a/rtemsspec/tests/test_items_item.py +++ b/rtemsspec/tests/test_items_item.py @@ -28,7 +28,7 @@ import os import pytest from rtemsspec.items import EmptyItemCache, Item, ItemGetValueContext, \ - JSONItemCache, Link + JSONItemCache, link_is_enabled, Link def test_to_abs_uid(): @@ -193,6 +193,8 @@ def test_parents(): assert child["links"][0]["foo"] == "bar" parents = [item for item in child.parents()] assert len(parents) == 1 + parents = [item for item in child.parents(is_link_enabled=link_is_enabled)] + assert len(parents) == 2 assert parents[0] == parent parents = [item for item in child.parents("c")] assert len(parents) == 1 |