Home / File/ test_tutorial009c.py — fastapi Source File

test_tutorial009c.py — fastapi Source File

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

File python FastAPI Routing 6 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8["test_tutorial009c.py"]
  498db554_9e30_154f_dda1_162f24e2873b["utils"]
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8 --> 498db554_9e30_154f_dda1_162f24e2873b
  83e01a9c_50a9_bec9_6f86_8e729106de01["importlib"]
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8 --> 83e01a9c_50a9_bec9_6f86_8e729106de01
  b423f231_0305_b686_5fea_7c66fe42f25b["re"]
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8 --> b423f231_0305_b686_5fea_7c66fe42f25b
  fb2d9376_ca24_f2b2_f130_cc10e9f2e732["types"]
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8 --> fb2d9376_ca24_f2b2_f130_cc10e9f2e732
  d1bf66df_8a92_7a7c_dab4_0865060effa4["unittest.mock"]
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8 --> d1bf66df_8a92_7a7c_dab4_0865060effa4
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  e774bc89_3683_9f20_eb3a_d62cf4e40ef8 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  style e774bc89_3683_9f20_eb3a_d62cf4e40ef8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import importlib
import re
from types import ModuleType
from unittest.mock import patch

import pytest

from ...utils import needs_py310


@pytest.fixture(
    name="module",
    params=[
        pytest.param("tutorial009c_py39"),
        pytest.param("tutorial009c_py310", marks=needs_py310),
    ],
)
def get_module(request: pytest.FixtureRequest):
    mod = importlib.import_module(f"docs_src.python_types.{request.param}")
    return mod


def test_say_hi(module: ModuleType):
    with patch("builtins.print") as mock_print:
        module.say_hi("FastAPI")

    mock_print.assert_called_once_with("Hey FastAPI!")

    with pytest.raises(
        TypeError,
        match=re.escape("say_hi() missing 1 required positional argument: 'name'"),
    ):
        module.say_hi()

Domain

Subdomains

Dependencies

  • importlib
  • pytest
  • re
  • types
  • unittest.mock
  • utils

Frequently Asked Questions

What does test_tutorial009c.py do?
test_tutorial009c.py is a source file in the fastapi codebase, written in python. It belongs to the FastAPI domain, Routing subdomain.
What functions are defined in test_tutorial009c.py?
test_tutorial009c.py defines 2 function(s): get_module, test_say_hi.
What does test_tutorial009c.py depend on?
test_tutorial009c.py imports 6 module(s): importlib, pytest, re, types, unittest.mock, utils.
Where is test_tutorial009c.py in the architecture?
test_tutorial009c.py is located at tests/test_tutorial/test_python_types/test_tutorial009c.py (domain: FastAPI, subdomain: Routing, directory: tests/test_tutorial/test_python_types).

Analyze Your Own Codebase

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

Try Supermodel Free