aboutsummaryrefslogtreecommitdiffstats
path: root/tests
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
parent6120118d581e7b6b16291b0bc7706f677697eb9e (diff)
downloadepy-90d951c958f18aecf82c9852d53119e7b124d028.tar.gz
Restructure and reorganize tests
Diffstat (limited to 'tests')
-rw-r--r--tests/test_text_parser.py23
-rw-r--r--tests/test_utils.py22
2 files changed, 23 insertions, 22 deletions
diff --git a/tests/test_text_parser.py b/tests/test_text_parser.py
index 3c61657..42a98d3 100644
--- a/tests/test_text_parser.py
+++ b/tests/test_text_parser.py
@@ -1,25 +1,4 @@
-from collections import namedtuple
-
-from epy import CharPos, TextMark, TextSpan, resolve_path, HTMLtoLines
-
-
-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
+from epy import CharPos, TextMark, TextSpan, HTMLtoLines
def test_mark_to_span():
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