test_openapi_schema_type.py — fastapi Source File
Architecture documentation for test_openapi_schema_type.py, a python file in the fastapi codebase. 4 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR e0a44ed7_a460_cdbd_f045_807af58463d9["test_openapi_schema_type.py"] 0dda2280_3359_8460_301c_e98c77e78185["typing"] e0a44ed7_a460_cdbd_f045_807af58463d9 --> 0dda2280_3359_8460_301c_e98c77e78185 5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"] e0a44ed7_a460_cdbd_f045_807af58463d9 --> 5befe8bf_65d1_d058_6b78_4a597a8488e9 7f688779_6b22_3c15_6514_97dec91c3c30["models.py"] e0a44ed7_a460_cdbd_f045_807af58463d9 --> 7f688779_6b22_3c15_6514_97dec91c3c30 2a82c6a7_41ca_0b2e_c2fa_75e9087154d5["Schema"] e0a44ed7_a460_cdbd_f045_807af58463d9 --> 2a82c6a7_41ca_0b2e_c2fa_75e9087154d5 style e0a44ed7_a460_cdbd_f045_807af58463d9 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
from typing import Optional, Union
import pytest
from fastapi.openapi.models import Schema, SchemaType
@pytest.mark.parametrize(
"type_value",
[
"array",
["string", "null"],
None,
],
)
def test_allowed_schema_type(
type_value: Optional[Union[SchemaType, list[SchemaType]]],
) -> None:
"""Test that Schema accepts SchemaType, List[SchemaType] and None for type field."""
schema = Schema(type=type_value)
assert schema.type == type_value
def test_invalid_type_value() -> None:
"""Test that Schema raises ValueError for invalid type values."""
with pytest.raises(ValueError, match="2 validation errors for Schema"):
Schema(type=True) # type: ignore[arg-type]
Domain
Subdomains
Source
Frequently Asked Questions
What does test_openapi_schema_type.py do?
test_openapi_schema_type.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_openapi_schema_type.py?
test_openapi_schema_type.py defines 2 function(s): test_allowed_schema_type, test_invalid_type_value.
What does test_openapi_schema_type.py depend on?
test_openapi_schema_type.py imports 4 module(s): Schema, models.py, pytest, typing.
Where is test_openapi_schema_type.py in the architecture?
test_openapi_schema_type.py is located at tests/test_openapi_schema_type.py (domain: FastAPI, subdomain: Routing, directory: tests).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free