-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_maketagdoc.py
30 lines (24 loc) · 1.06 KB
/
test_maketagdoc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from pathlib import Path
import pytest
from tagmark.tools.maketagdoc import TagDocMaker
class TestTagDocMaker:
@classmethod
@pytest.fixture(autouse=True)
def setup(cls, test_input_file_paths):
cls.tag_doc_maker: TagDocMaker = TagDocMaker(
tagmark_jsonlines_data_path=test_input_file_paths["tagmark_jsonlines_data"],
tags_json_path=test_input_file_paths["tags_json"],
config_path=Path("tagmark/tools/maketagdoc.toml.default").absolute(),
url_base="https://pwnfan.github.io/tagmark",
condition_json_path=test_input_file_paths["condition_json"],
is_ban_condition=True,
)
def test_format_line(self):
error_line = "* test error line: {{xxx:yyy}}"
with pytest.raises(ValueError):
self.tag_doc_maker._format_line(line=error_line)
def test_make(self):
with open("tests/data/maketagdoc_template.md") as ft, open(
"tests/data/maketagdoc_result.md"
) as fr:
assert self.tag_doc_maker.make(ft.read()) == fr.read()