aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_utils.py
diff options
context:
space:
mode:
authorbenadha <benawiadha@gmail.com>2022-01-14 20:16:29 +0700
committerbenadha <benawiadha@gmail.com>2022-01-14 20:16:29 +0700
commit90d951c958f18aecf82c9852d53119e7b124d028 (patch)
treefd161340f8109f3896b333409b63ca11eadaa9dd /tests/test_utils.py
parent6120118d581e7b6b16291b0bc7706f677697eb9e (diff)
downloadepy-90d951c958f18aecf82c9852d53119e7b124d028.tar.gz
Restructure and reorganize tests
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r--tests/test_utils.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/test_utils.py b/tests/test_utils.py
new file mode 100644
index 0000000..4274adf
--- /dev/null
+++ b/tests/test_utils.py
@@ -0,0 +1,22 @@
+from collections import namedtuple
+
+from epy import resolve_path
+
+
+def test_resolve_path():
+ UnresolvedPath = namedtuple("UnresolvedPath", ["current_dir", "relative_path"])
+
+ inputs = [
+ UnresolvedPath("/aaa/bbb/book.html", "../ccc.png"),
+ UnresolvedPath("/aaa/bbb/book.html", "../../ccc.png"),
+ UnresolvedPath("aaa/bbb/book.html", "../../ccc.png"),
+ ]
+
+ expecteds = [
+ "/aaa/ccc.png",
+ "/ccc.png",
+ "ccc.png",
+ ]
+
+ for input, expected in zip(inputs, expecteds):
+ assert resolve_path(input.current_dir, input.relative_path) == expected