Home / File/ test_code_blocks_mermaid.py — fastapi Source File

test_code_blocks_mermaid.py — fastapi Source File

Architecture documentation for test_code_blocks_mermaid.py, a python file in the fastapi codebase. 5 imports, 0 dependents.

File python FastAPI Responses 5 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  388303cd_0b88_353a_b73e_39f18234feda["test_code_blocks_mermaid.py"]
  b3e303a2_3f2d_638d_930c_3a5dcc2f5a42["pathlib"]
  388303cd_0b88_353a_b73e_39f18234feda --> b3e303a2_3f2d_638d_930c_3a5dcc2f5a42
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  388303cd_0b88_353a_b73e_39f18234feda --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  50e86d72_8593_e02d_8fa4_63659153e8bf["typer.testing"]
  388303cd_0b88_353a_b73e_39f18234feda --> 50e86d72_8593_e02d_8fa4_63659153e8bf
  99e3c039_dae8_2ebf_8149_637bcc119c08["translation_fixer.py"]
  388303cd_0b88_353a_b73e_39f18234feda --> 99e3c039_dae8_2ebf_8149_637bcc119c08
  f3d7b32d_2379_8b46_1d7c_05f2c6f38a29["cli"]
  388303cd_0b88_353a_b73e_39f18234feda --> f3d7b32d_2379_8b46_1d7c_05f2c6f38a29
  style 388303cd_0b88_353a_b73e_39f18234feda 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_code_blocks/data"
).absolute()


@pytest.mark.parametrize(
    "copy_test_files",
    [(f"{data_path}/en_doc.md", f"{data_path}/translated_doc_mermaid_translated.md")],
    indirect=True,
)
def test_translated(runner: CliRunner, root_dir: Path, copy_test_files):
    result = runner.invoke(
        cli,
        ["fix-pages", "docs/lang/docs/doc.md"],
    )
    assert result.exit_code == 0, result.output

    fixed_content = (root_dir / "docs" / "lang" / "docs" / "doc.md").read_text("utf-8")
    expected_content = Path(
        f"{data_path}/translated_doc_mermaid_translated.md"
    ).read_text("utf-8")

    assert fixed_content == expected_content  # Translated doc remains unchanged
    assert (
        "Skipping mermaid code block replacement (lines 41-44). This should be checked manually."
    ) in result.output


@pytest.mark.parametrize(
    "copy_test_files",
    [
        (
            f"{data_path}/en_doc.md",
            f"{data_path}/translated_doc_mermaid_not_translated.md",
        )
    ],
    indirect=True,
)
def test_not_translated(runner: CliRunner, root_dir: Path, copy_test_files):
    result = runner.invoke(
        cli,
        ["fix-pages", "docs/lang/docs/doc.md"],
    )
    assert result.exit_code == 0, result.output

    fixed_content = (root_dir / "docs" / "lang" / "docs" / "doc.md").read_text("utf-8")
    expected_content = Path(
        f"{data_path}/translated_doc_mermaid_not_translated.md"
    ).read_text("utf-8")

    assert fixed_content == expected_content  # Translated doc remains unchanged
    assert ("Skipping mermaid code block replacement") not in result.output

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_code_blocks_mermaid.py do?
test_code_blocks_mermaid.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_code_blocks_mermaid.py?
test_code_blocks_mermaid.py defines 2 function(s): test_not_translated, test_translated.
What does test_code_blocks_mermaid.py depend on?
test_code_blocks_mermaid.py imports 5 module(s): cli, pathlib, pytest, translation_fixer.py, typer.testing.
Where is test_code_blocks_mermaid.py in the architecture?
test_code_blocks_mermaid.py is located at scripts/tests/test_translation_fixer/test_code_blocks/test_code_blocks_mermaid.py (domain: FastAPI, subdomain: Responses, directory: scripts/tests/test_translation_fixer/test_code_blocks).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free