Files

45 lines
1.1 KiB
Python

from pathlib import Path
import zipfile
from xml.etree import ElementTree
GUIDE = Path("docs/user/DxDesigner_7.9.5_自动位号工具使用说明_v0.5.docx")
WORD_NS = {"w": "http://schemas.openxmlformats.org/wordprocessingml/2006/main"}
def _document_text() -> str:
with zipfile.ZipFile(GUIDE) as archive:
document = ElementTree.fromstring(archive.read("word/document.xml"))
return "\n".join(
text.text or "" for text in document.findall(".//w:t", WORD_NS)
)
def test_user_guide_documents_portable_offline_workflow() -> None:
text = _document_text()
for required in (
"解压整个目录",
"MenuAdd.vbs",
"无需安装 Python",
"%LOCALAPPDATA%\\DxProductivity",
"兼容性检测",
"自动回滚",
"重新导入",
):
assert required in text
def test_user_guide_does_not_instruct_legacy_installation() -> None:
text = _document_text()
for forbidden in (
"安装 64 位 Python",
"pip install",
"DXTOOLS_HOME",
"D:\\NET_CHECK",
"Install.ps1",
"Uninstall.ps1",
):
assert forbidden not in text