summaryrefslogtreecommitdiffstats
path: root/rtemsspec/validation.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-13 17:29:48 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-12-13 20:31:55 +0100
commit27c788bda1624a665830d34b4cc7c9337ca1ce2b (patch)
treebfc05fd07962d3ad7dc896ec434936ad9b3cbad1 /rtemsspec/validation.py
parentitems: Optional post-process load in ItemCache (diff)
downloadrtems-central-27c788bda1624a665830d34b4cc7c9337ca1ce2b.tar.bz2
items: Simplify ItemMapper
Diffstat (limited to 'rtemsspec/validation.py')
-rw-r--r--rtemsspec/validation.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/rtemsspec/validation.py b/rtemsspec/validation.py
index 289b6a6e..3663acba 100644
--- a/rtemsspec/validation.py
+++ b/rtemsspec/validation.py
@@ -62,7 +62,10 @@ class _Mapper(ItemMapper):
""" Resets the test step counter. """
self._step = 0
- def map(self, identifier: str) -> Tuple[Item, str, Any]:
+ def map(self,
+ identifier: str,
+ item: Optional[Item] = None,
+ prefix: Optional[str] = None) -> Tuple[Item, str, Any]:
if identifier == "step":
step = self._step
self._step = step + 1
@@ -72,7 +75,7 @@ class _Mapper(ItemMapper):
inc = int(match.group(1))
self._step += inc
return self._item, "step", f"Accounts for {inc} test plan steps"
- return super().map(identifier)
+ return super().map(identifier, item, prefix)
def _add_ingroup(content: CContent, items: List["_TestItem"]) -> None:
@@ -151,9 +154,7 @@ class _TestItem:
"""
Performs a variable substitution for text with an optional prefix.
"""
- if prefix:
- return self._mapper.substitute_with_prefix(text, prefix)
- return self._mapper.substitute(text)
+ return self._mapper.substitute(text, prefix=prefix)
def add_test_case_description(
self, content: CContent,