summaryrefslogtreecommitdiff
path: root/tests/test_yaml_parser.py
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2023-02-19 23:36:04 -0600
committerDavid Luevano Alvarado <david@luevano.xyz>2023-02-19 23:36:04 -0600
commitf2ab2bac6b26f82730d5f5d7ab1e6d5f2f1060e3 (patch)
tree88a1ce15061cd7a9cee00941bc9ff3c39e09ab5e /tests/test_yaml_parser.py
parente28fbb181851ca16bc0ade9c371628f86c25adbc (diff)
add yaml_parser tests, small refactor
Diffstat (limited to 'tests/test_yaml_parser.py')
-rw-r--r--tests/test_yaml_parser.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/test_yaml_parser.py b/tests/test_yaml_parser.py
new file mode 100644
index 0000000..9a1b3c3
--- /dev/null
+++ b/tests/test_yaml_parser.py
@@ -0,0 +1,19 @@
+from importlib.resources import path as rpath
+from pyssg.yaml_parser import get_parsed_yaml
+
+
+def test_yaml_resource_read() -> None:
+ yaml: list[dict] = get_parsed_yaml('simple.yaml', 'tests.io_files')
+ assert len(yaml) == 1
+
+
+def test_yaml_path_read(test_dir: str) -> None:
+ yaml: list[dict] = get_parsed_yaml(f'{test_dir}/io_files/simple.yaml')
+ assert len(yaml) == 1
+
+
+def test_yaml_join() -> None:
+ yaml: dict = get_parsed_yaml('simple.yaml', 'tests.io_files')[0]
+ define_str: str = '$HOME/pyssg/site_example/'
+ assert yaml['define'] == define_str
+ assert yaml['path']['src'] == f'{define_str}src'