+ Topic 01
+
+ First topic in root map 1
+
+
diff --git a/src/main/python/test/test_config.py b/src/main/python/test/test_config.py
new file mode 100644
index 0000000..13f7446
--- /dev/null
+++ b/src/main/python/test/test_config.py
@@ -0,0 +1,40 @@
+"""Test configuration module.
+"""
+
+import os
+import sys
+
+from .fixtures import resourcesDir, rootMap1Path
+
+from ditalib import config
+
+def test_readPropertiesFile(resourcesDir):
+ configPath: str = os.path.join(resourcesDir, "config", "test.properties")
+ assert os.path.exists(configPath), f'Expected to find test resource "{configPath}"'
+ props: dict[str, str] = config.readPropertiesFile(configPath)
+ assert props is not None, f'Exected to get a props dictionary.'
+ name: str = "prop1"
+ value: str = props[name]
+ expected: str = "value1"
+ assert value == expected, f'Expected value "{expected}" for property "{name}", got "{value}"'
+ name: str = "prop2"
+ value: str = props[name]
+ expected: str = "value2"
+ assert value == expected, f'Expected value "{expected}" for property "{name}", got "{value}"'
+ # prop3.name=This is a value with spaces
+ name: str = "prop3.name"
+ value: str = props[name]
+ expected: str = "This is a value with spaces"
+ assert value == expected, f'Expected value "{expected}" for property "{name}", got "{value}"'
+ # prop4-more-name="Value in quotes"
+ name: str = "prop4-more-name"
+ value: str = props[name]
+ expected: str = '"Value in quotes"'
+ assert value == expected, f'Expected value "{expected}" for property "{name}", got "{value}"'
+
+def test_getDitaOtPath(resourcesDir):
+ os.environ[config.otDirEnvVariable] = os.path.join(resourcesDir, "dita-ot")
+ path: str = config.getDitaOtPath()
+ assert path is not None, f'Expected to get a value for the OT path'
+ assert os.path.exists(path), f'Expected path "{path}" to exist'
+
\ No newline at end of file
diff --git a/src/main/python/test/test_logging.py b/src/main/python/test/test_logging.py
new file mode 100644
index 0000000..d6aeef2
--- /dev/null
+++ b/src/main/python/test/test_logging.py
@@ -0,0 +1,30 @@
+"""Test configuration module.
+"""
+
+import os
+import sys
+
+from .fixtures import resourcesDir, rootMap1Path
+
+import ditalib.logging
+from ditalib.logging import Errors, ErrorRecord
+
+def test_readPropertiesFile(resourcesDir):
+ assert ditalib.logging.WARN == "warning", f'Expected ditalib.logging.WARN to be "warning", got "{ditalib.logging.WARN}"'
+ assert ditalib.logging.ERROR == "error", f'Expected ditalib.logging.ERROR to be "error", got "{ditalib.logging.ERROR}"'
+ errors: Errors = Errors()
+ assert len(errors.keys()) == 0, f'Expected to have an empty dictionary, got {len(errors.key())}.'
+ key: str = "key1"
+ errors.logError(key, "Error message 1", severity=ditalib.logging.WARN)
+ assert len(errors.keys()) == 1, f'Expected to have 1 key, got {len(errors.key())}.'
+ errors.logError(key, "Error message 2")
+ assert len(errors.keys()) == 1, f'Expected to have 1 key, got {len(errors.key())}.'
+ errorsForKey: list[ErrorRecord] = errors.get(key)
+ assert errorsForKey is not None, f'Expected to get a list of errors for key "{key}"'
+ assert len(errorsForKey) == 2, f'Expected to have 2 errors in the list, have {len(errorsForKey)}.'
+ error: ErrorRecord = errorsForKey[0]
+ assert error.getKey() == key, f'Expected key to be "{key}", got "{error.getKey()}"'
+ assert error.getSeverity() == ditalib.logging.WARN, f'Expected severity of WARN, got {error.getSeverity()}'
+ #err: Exception = error.getException()
+ #assert err is not None, f'Expected to have an Exception object.'
+ #assert str(err) == "Error message 1", f'Expected exception message "Error message 1", got "{str(err)}"'
\ No newline at end of file
diff --git a/src/main/python/test/test_xmlutils.py b/src/main/python/test/test_xmlutils.py
new file mode 100644
index 0000000..9cf4cc3
--- /dev/null
+++ b/src/main/python/test/test_xmlutils.py
@@ -0,0 +1,30 @@
+"""Tests for the xmlutils module
+"""
+
+
+
+from lxml import etree
+from lxml.etree import Element, ElementTree, XMLParser
+
+from ditalib import xmlutils
+
+from .fixtures import resourcesDir, rootMap1Path
+
+def test_getDTDAwareParser(rootMap1Path):
+ parser: XMLParser = xmlutils.getDTDAwareParser()
+ assert parser is not None, f'Expected to get a parser.'
+ parsed: ElementTree = etree.parse(rootMap1Path, parser)
+ assert parsed is not None, f'Expected to get a parsed document'
+ elem: Element = parsed.getroot()
+ assert elem is not None, f'Expected to get a root element'
+ assert elem.get("class") is not None, f'Expected to get a @class attribute. Atts are {elem.attrib}'
+
+def test_getNoDTDParser(rootMap1Path):
+ parser: XMLParser = xmlutils.getNoDTDParser()
+ assert parser is not None, f'Expected to get a parser.'
+ parsed: ElementTree = etree.parse(rootMap1Path, parser)
+ assert parsed is not None, f'Expected to get a parsed document'
+ elem: Element = parsed.getroot()
+ assert elem is not None, f'Expected to get a root element'
+ assert elem.get("class") is None, f'Expected to not get a @class attribute. Atts are {elem.attrib}'
+
\ No newline at end of file