summaryrefslogtreecommitdiffstats
path: root/rtemsqual/tests/test_content_sphinx.py
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-05-06 10:31:57 +0200
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-05-28 10:37:29 +0200
commita5f3cc1d59cc2d51813d60562011a7954e0d6f21 (patch)
tree227fce2d226584c5b3e8b439d07a4b015e459b01 /rtemsqual/tests/test_content_sphinx.py
parentMove license and copyright registration of items (diff)
downloadrtems-central-a5f3cc1d59cc2d51813d60562011a7954e0d6f21.tar.bz2
spec: Use item mapper for glossary terms
Diffstat (limited to 'rtemsqual/tests/test_content_sphinx.py')
-rw-r--r--rtemsqual/tests/test_content_sphinx.py28
1 files changed, 9 insertions, 19 deletions
diff --git a/rtemsqual/tests/test_content_sphinx.py b/rtemsqual/tests/test_content_sphinx.py
index 8a406706..fa1823d2 100644
--- a/rtemsqual/tests/test_content_sphinx.py
+++ b/rtemsqual/tests/test_content_sphinx.py
@@ -26,14 +26,9 @@
import pytest
-from rtemsqual.content import SphinxContent
-from rtemsqual.content import MacroToSphinx
-from rtemsqual.items import Item, ItemCache
-
-
-class EmptyCache(ItemCache):
- def __init__(self):
- return
+from rtemsqual.content import SphinxContent, SphinxMapper
+from rtemsqual.items import Item, ItemCache, ItemMapper
+from rtemsqual.tests.util import create_item_cache_config_and_copy_spec
def test_add_label():
@@ -122,15 +117,10 @@ def test_license_and_copyrights():
"""
-def test_substitute():
- macro_to_sphinx = MacroToSphinx()
- data = {}
- data["glossary-term"] = "y"
- terms = {}
- terms["x"] = Item(EmptyCache(), "x", data)
- macro_to_sphinx.set_terms(terms)
- assert "@" == macro_to_sphinx.substitute("@@")
- assert "@x" == macro_to_sphinx.substitute("@x")
+def test_substitute(tmpdir):
+ config = create_item_cache_config_and_copy_spec(tmpdir, "spec-sphinx")
+ item_cache = ItemCache(config)
+ mapper = SphinxMapper(item_cache["/x"])
with pytest.raises(KeyError):
- macro_to_sphinx.substitute("@x{y}")
- assert ":term:`y`" == macro_to_sphinx.substitute("@term{x}")
+ mapper.substitute("${x:/y}")
+ assert ":term:`y`" == mapper.substitute("${x:/glossary-term}")