Home / File/ test_tutorial008b.py — fastapi Source File

test_tutorial008b.py — fastapi Source File

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

File python FastAPI Responses 3 imports 4 functions

Entity Profile

Dependency Diagram

graph LR
  396d7417_b49a_fdf8_57c0_77bfe5683032["test_tutorial008b.py"]
  83e01a9c_50a9_bec9_6f86_8e729106de01["importlib"]
  396d7417_b49a_fdf8_57c0_77bfe5683032 --> 83e01a9c_50a9_bec9_6f86_8e729106de01
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  396d7417_b49a_fdf8_57c0_77bfe5683032 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  396d7417_b49a_fdf8_57c0_77bfe5683032 --> a7c04dee_ee23_5891_b185_47ff6bed036d
  style 396d7417_b49a_fdf8_57c0_77bfe5683032 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import importlib

import pytest
from fastapi.testclient import TestClient


@pytest.fixture(
    name="client",
    params=[
        pytest.param("tutorial008b_py39"),
        pytest.param("tutorial008b_an_py39"),
    ],
)
def get_client(request: pytest.FixtureRequest):
    mod = importlib.import_module(f"docs_src.dependencies.{request.param}")

    client = TestClient(mod.app)
    return client


def test_get_no_item(client: TestClient):
    response = client.get("/items/foo")
    assert response.status_code == 404, response.text
    assert response.json() == {"detail": "Item not found"}


def test_owner_error(client: TestClient):
    response = client.get("/items/plumbus")
    assert response.status_code == 400, response.text
    assert response.json() == {"detail": "Owner error: Rick"}


def test_get_item(client: TestClient):
    response = client.get("/items/portal-gun")
    assert response.status_code == 200, response.text
    assert response.json() == {"description": "Gun to create portals", "owner": "Rick"}

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_tutorial008b.py do?
test_tutorial008b.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_tutorial008b.py?
test_tutorial008b.py defines 4 function(s): get_client, test_get_item, test_get_no_item, test_owner_error.
What does test_tutorial008b.py depend on?
test_tutorial008b.py imports 3 module(s): importlib, pytest, testclient.py.
Where is test_tutorial008b.py in the architecture?
test_tutorial008b.py is located at tests/test_tutorial/test_dependencies/test_tutorial008b.py (domain: FastAPI, subdomain: Responses, directory: tests/test_tutorial/test_dependencies).

Analyze Your Own Codebase

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

Try Supermodel Free