test_header_level_mismatch.py — fastapi Source File
Architecture documentation for test_header_level_mismatch.py, a python file in the fastapi codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR ea780e59_0602_ee14_b646_ddf831d7faec["test_header_level_mismatch.py"] b3e303a2_3f2d_638d_930c_3a5dcc2f5a42["pathlib"] ea780e59_0602_ee14_b646_ddf831d7faec --> b3e303a2_3f2d_638d_930c_3a5dcc2f5a42 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] ea780e59_0602_ee14_b646_ddf831d7faec --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 50e86d72_8593_e02d_8fa4_63659153e8bf["typer.testing"] ea780e59_0602_ee14_b646_ddf831d7faec --> 50e86d72_8593_e02d_8fa4_63659153e8bf 99e3c039_dae8_2ebf_8149_637bcc119c08["translation_fixer.py"] ea780e59_0602_ee14_b646_ddf831d7faec --> 99e3c039_dae8_2ebf_8149_637bcc119c08 f3d7b32d_2379_8b46_1d7c_05f2c6f38a29["cli"] ea780e59_0602_ee14_b646_ddf831d7faec --> f3d7b32d_2379_8b46_1d7c_05f2c6f38a29 style ea780e59_0602_ee14_b646_ddf831d7faec fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from pathlib import Path
import pytest
from typer.testing import CliRunner
from scripts.translation_fixer import cli
data_path = Path(
"scripts/tests/test_translation_fixer/test_header_permalinks/data"
).absolute()
@pytest.mark.parametrize(
"copy_test_files",
[(f"{data_path}/en_doc.md", f"{data_path}/translated_doc_level_mismatch_1.md")],
indirect=True,
)
def test_level_mismatch_1(runner: CliRunner, root_dir: Path, copy_test_files):
result = runner.invoke(
cli,
["fix-pages", "docs/lang/docs/doc.md"],
)
assert result.exit_code == 1
fixed_content = (root_dir / "docs" / "lang" / "docs" / "doc.md").read_text("utf-8")
expected_content = Path(
f"{data_path}/translated_doc_level_mismatch_1.md"
).read_text("utf-8")
assert fixed_content == expected_content # Translated doc remains unchanged
assert "Error processing docs/lang/docs/doc.md" in result.output
assert (
"Header levels do not match between document and original document"
" (found #, expected ##) for header №2 in line 5"
) in result.output
@pytest.mark.parametrize(
"copy_test_files",
[(f"{data_path}/en_doc.md", f"{data_path}/translated_doc_level_mismatch_2.md")],
indirect=True,
)
def test_level_mismatch_2(runner: CliRunner, root_dir: Path, copy_test_files):
result = runner.invoke(
cli,
["fix-pages", "docs/lang/docs/doc.md"],
)
assert result.exit_code == 1
fixed_content = (root_dir / "docs" / "lang" / "docs" / "doc.md").read_text("utf-8")
expected_content = Path(
f"{data_path}/translated_doc_level_mismatch_2.md"
).read_text("utf-8")
assert fixed_content == expected_content # Translated doc remains unchanged
assert "Error processing docs/lang/docs/doc.md" in result.output
assert (
"Header levels do not match between document and original document"
" (found ##, expected #) for header №4 in line 13"
) in result.output
Domain
Subdomains
Dependencies
- cli
- pathlib
- pytest
- translation_fixer.py
- typer.testing
Source
Frequently Asked Questions
What does test_header_level_mismatch.py do?
test_header_level_mismatch.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Responses subdomain.
What functions are defined in test_header_level_mismatch.py?
test_header_level_mismatch.py defines 2 function(s): test_level_mismatch_1, test_level_mismatch_2.
What does test_header_level_mismatch.py depend on?
test_header_level_mismatch.py imports 5 module(s): cli, pathlib, pytest, translation_fixer.py, typer.testing.
Where is test_header_level_mismatch.py in the architecture?
test_header_level_mismatch.py is located at scripts/tests/test_translation_fixer/test_header_permalinks/test_header_level_mismatch.py (domain: FastAPI, subdomain: Responses, directory: scripts/tests/test_translation_fixer/test_header_permalinks).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free