summaryrefslogtreecommitdiffstats
path: root/rtemsspec
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-14 07:23:59 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-08-19 11:29:34 +0200
commited25048ef4341d48b36806005ef90668b5eee4c6 (patch)
treef5197cc8242cbf60f6bd41fcb070a90eaf9352b2 /rtemsspec
parentvalidation: Use dictionary to gather items (diff)
downloadrtems-central-ed25048ef4341d48b36806005ef90668b5eee4c6.tar.bz2
items: Add Item.spec
Diffstat (limited to 'rtemsspec')
-rw-r--r--rtemsspec/items.py5
-rw-r--r--rtemsspec/tests/test_items_item.py5
-rw-r--r--rtemsspec/validation.py2
3 files changed, 11 insertions, 1 deletions
diff --git a/rtemsspec/items.py b/rtemsspec/items.py
index cdcf451d..4da02dde 100644
--- a/rtemsspec/items.py
+++ b/rtemsspec/items.py
@@ -184,6 +184,11 @@ class Item:
""" Returns the UID of the item. """
return self._uid
+ @property
+ def spec(self) -> str:
+ """ Returns the UID of the item with an URL-like format. """
+ return f"spec:{self._uid}"
+
def to_abs_uid(self, abs_or_rel_uid: str) -> str:
"""
Returns the absolute UID of an absolute UID or an UID relative to this
diff --git a/rtemsspec/tests/test_items_item.py b/rtemsspec/tests/test_items_item.py
index 511349ab..a388b9bd 100644
--- a/rtemsspec/tests/test_items_item.py
+++ b/rtemsspec/tests/test_items_item.py
@@ -44,6 +44,11 @@ def test_uid():
assert item.uid == "x"
+def test_spec():
+ item = Item(EmptyItemCache(), "x", {})
+ assert item.spec == "spec:x"
+
+
def test_contains():
data = {}
data["x"] = "y"
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index e37d5a56..dec69990 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -98,7 +98,7 @@ class _TestItem:
@property
def name(self) -> str:
""" Returns the name. """
- return f"spec:{self._item.uid}"
+ return self._item.spec
@property
def includes(self) -> List[str]: