Home / File/ test_pydanticv2_dataclasses_uuid_stringified_annotations.py — fastapi Source File

test_pydanticv2_dataclasses_uuid_stringified_annotations.py — fastapi Source File

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

File python FastAPI Responses 7 imports 2 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  7cb7ec4f_1282_a492_f970_946a94aa9eed["test_pydanticv2_dataclasses_uuid_stringified_annotations.py"]
  90bacbf7_ee4e_4955_c1b3_1214f56df7b1["uuid"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> 90bacbf7_ee4e_4955_c1b3_1214f56df7b1
  4cff5a35_9399_b238_3d2b_e2cca82878e1["dataclasses"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> 4cff5a35_9399_b238_3d2b_e2cca82878e1
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> 0dda2280_3359_8460_301c_e98c77e78185
  752ca3d8_e45b_84ed_d1a1_588cbc236b65["dirty_equals"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> 752ca3d8_e45b_84ed_d1a1_588cbc236b65
  534f6e44_61b8_3c38_8b89_6934a6df9802["__init__.py"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> 534f6e44_61b8_3c38_8b89_6934a6df9802
  a7c04dee_ee23_5891_b185_47ff6bed036d["testclient.py"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> a7c04dee_ee23_5891_b185_47ff6bed036d
  a7f4e7b0_9725_db90_5cbc_7ca8211b323a["inline_snapshot"]
  7cb7ec4f_1282_a492_f970_946a94aa9eed --> a7f4e7b0_9725_db90_5cbc_7ca8211b323a
  style 7cb7ec4f_1282_a492_f970_946a94aa9eed fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from __future__ import annotations

import uuid
from dataclasses import dataclass, field
from typing import Union

from dirty_equals import IsUUID
from fastapi import FastAPI
from fastapi.testclient import TestClient
from inline_snapshot import snapshot


@dataclass
class Item:
    id: uuid.UUID
    name: str
    price: float
    tags: list[str] = field(default_factory=list)
    description: Union[str, None] = None
    tax: Union[float, None] = None


app = FastAPI()


@app.get("/item", response_model=Item)
async def read_item():
    return {
        "id": uuid.uuid4(),
        "name": "Island In The Moon",
        "price": 12.99,
        "description": "A place to be be playin' and havin' fun",
        "tags": ["breater"],
    }


client = TestClient(app)


def test_annotations():
    response = client.get("/item")
    assert response.status_code == 200, response.text
    assert response.json() == snapshot(
        {
            "id": IsUUID(),
            "name": "Island In The Moon",
            "price": 12.99,
            "tags": ["breater"],
            "description": "A place to be be playin' and havin' fun",
            "tax": None,
        }
    )

Domain

Subdomains

Classes

Dependencies

Frequently Asked Questions

What does test_pydanticv2_dataclasses_uuid_stringified_annotations.py do?
test_pydanticv2_dataclasses_uuid_stringified_annotations.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_pydanticv2_dataclasses_uuid_stringified_annotations.py?
test_pydanticv2_dataclasses_uuid_stringified_annotations.py defines 2 function(s): read_item, test_annotations.
What does test_pydanticv2_dataclasses_uuid_stringified_annotations.py depend on?
test_pydanticv2_dataclasses_uuid_stringified_annotations.py imports 7 module(s): __init__.py, dataclasses, dirty_equals, inline_snapshot, testclient.py, typing, uuid.
Where is test_pydanticv2_dataclasses_uuid_stringified_annotations.py in the architecture?
test_pydanticv2_dataclasses_uuid_stringified_annotations.py is located at tests/test_pydanticv2_dataclasses_uuid_stringified_annotations.py (domain: FastAPI, subdomain: Responses, directory: tests).

Analyze Your Own Codebase

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

Try Supermodel Free