Debian Codegraph @

scripts/tests/test_translation_fixer/test_complex_doc/test_compex_doc.py

raw
1 from pathlib import Path
2
3 import pytest
4 from typer.testing import CliRunner
5
6 from scripts.translation_fixer import cli
7
8 data_path = Path(
9 "scripts/tests/test_translation_fixer/test_complex_doc/data"
10 ).absolute()
11
12
13 @pytest.mark.parametrize(
14 "copy_test_files",
15 [(f"{data_path}/en_doc.md", f"{data_path}/translated_doc.md")],
16 indirect=True,
17 )
18 def test_fix(runner: CliRunner, root_dir: Path, copy_test_files):
19 result = runner.invoke(
20 cli,
21 ["fix-pages", "docs/lang/docs/doc.md"],
22 )
23 assert result.exit_code == 0, result.output
24
25 fixed_content = (root_dir / "docs" / "lang" / "docs" / "doc.md").read_text("utf-8")
26 expected_content = (data_path / "translated_doc_expected.md").read_text("utf-8")
27 assert fixed_content == expected_content
28
29 assert "Fixing multiline code blocks in" in result.output
30 assert "Fixing markdown links in" in result.output