- fix Не появляется пустая странициа перед названием таблицы - fix Не появляется пустая страница перед альбомной ориентацией - fix При отказе от изменений создаётся новый файл - fix Замена "..." на «...» больше не затрагивает uml и mermaid блоки
This commit is contained in:
+23
-1
@@ -4,7 +4,13 @@ import os
|
||||
import sys
|
||||
|
||||
from md2gost.dnd import first_markdown, normalize_drop_paths, parse_tkdnd_files
|
||||
from md2gost.pipeline import ConvertRequest, convert, default_output_path, should_launch_gui
|
||||
from md2gost.pipeline import (
|
||||
ConvertRequest,
|
||||
convert,
|
||||
default_output_path,
|
||||
should_launch_gui,
|
||||
timestamped_output_path,
|
||||
)
|
||||
from md2gost.__main__ import build_parser, request_from_args
|
||||
|
||||
|
||||
@@ -20,6 +26,22 @@ def test_default_output_path():
|
||||
assert path.endswith("report.docx")
|
||||
|
||||
|
||||
def test_timestamped_output_path(tmp_path):
|
||||
import re
|
||||
src = tmp_path / "ПР1.docx"
|
||||
src.write_bytes(b"x")
|
||||
out = timestamped_output_path(str(src))
|
||||
name = os.path.basename(out)
|
||||
assert re.fullmatch(r"ПР1_\d{4}-\d{2}-\d{2}-\d{2}-\d{2}\.docx", name)
|
||||
assert not os.path.exists(out)
|
||||
# collision → seconds (or seconds_2)
|
||||
open(out, "wb").close()
|
||||
out2 = timestamped_output_path(str(src))
|
||||
assert out2 != out
|
||||
assert os.path.basename(out2).startswith("ПР1_")
|
||||
assert out2.endswith(".docx")
|
||||
|
||||
|
||||
def test_parse_tkdnd_files():
|
||||
raw = r"{C:\My Files\a.md} C:\tmp\b.md"
|
||||
assert parse_tkdnd_files(raw) == [r"C:\My Files\a.md", r"C:\tmp\b.md"]
|
||||
|
||||
Reference in New Issue
Block a user