Home / File/ test_jsonable_encoder.py — fastapi Source File

test_jsonable_encoder.py — fastapi Source File

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

File python FastAPI Routing 16 imports 24 functions 18 classes

Entity Profile

Dependency Diagram

graph LR
  80ce950d_4c72_e7d9_21bb_a5c60524786c["test_jsonable_encoder.py"]
  9c2c9cad_dfd2_7d1a_1c6d_b8a448285db4["warnings"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 9c2c9cad_dfd2_7d1a_1c6d_b8a448285db4
  36df6c22_bdda_c58d_8489_1b2bca07e51a["collections"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 36df6c22_bdda_c58d_8489_1b2bca07e51a
  4cff5a35_9399_b238_3d2b_e2cca82878e1["dataclasses"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 4cff5a35_9399_b238_3d2b_e2cca82878e1
  e973e384_8276_b242_eb98_1c0b79a84e68["datetime"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> e973e384_8276_b242_eb98_1c0b79a84e68
  f9d54b01_68e2_bbed_c8ee_3f6749520bcb["decimal"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> f9d54b01_68e2_bbed_c8ee_3f6749520bcb
  712b7268_fde0_3ca8_dc06_7aa9a47c77d9["enum"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 712b7268_fde0_3ca8_dc06_7aa9a47c77d9
  5aa90753_fd32_7bbd_1570_d7ddb73388b0["math"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 5aa90753_fd32_7bbd_1570_d7ddb73388b0
  b3e303a2_3f2d_638d_930c_3a5dcc2f5a42["pathlib"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> b3e303a2_3f2d_638d_930c_3a5dcc2f5a42
  0dda2280_3359_8460_301c_e98c77e78185["typing"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 0dda2280_3359_8460_301c_e98c77e78185
  5befe8bf_65d1_d058_6b78_4a597a8488e9["pytest"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 5befe8bf_65d1_d058_6b78_4a597a8488e9
  aac750d7_00e7_a28d_9e64_89918311078b["__init__.py"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> aac750d7_00e7_a28d_9e64_89918311078b
  ea747667_035c_8539_a8f7_f347fb7e7c39["encoders.py"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> ea747667_035c_8539_a8f7_f347fb7e7c39
  1ac1bc37_1a47_e7e2_9156_ab0473094700["jsonable_encoder"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 1ac1bc37_1a47_e7e2_9156_ab0473094700
  01c652c5_d85c_f45e_848e_412c94ea4172["exceptions.py"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c --> 01c652c5_d85c_f45e_848e_412c94ea4172
  style 80ce950d_4c72_e7d9_21bb_a5c60524786c fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import warnings
from collections import deque
from dataclasses import dataclass
from datetime import datetime, timezone
from decimal import Decimal
from enum import Enum
from math import isinf, isnan
from pathlib import PurePath, PurePosixPath, PureWindowsPath
from typing import Optional, TypedDict

import pytest
from fastapi._compat import Undefined
from fastapi.encoders import jsonable_encoder
from fastapi.exceptions import PydanticV1NotSupportedError
from pydantic import BaseModel, Field, ValidationError


class Person:
    def __init__(self, name: str):
        self.name = name


class Pet:
    def __init__(self, owner: Person, name: str):
        self.owner = owner
        self.name = name


@dataclass
class Item:
    name: str
    count: int


class DictablePerson(Person):
    def __iter__(self):
        return ((k, v) for k, v in self.__dict__.items())


class DictablePet(Pet):
    def __iter__(self):
        return ((k, v) for k, v in self.__dict__.items())


class Unserializable:
    def __iter__(self):
        raise NotImplementedError()

    @property
    def __dict__(self):
        raise NotImplementedError()


class RoleEnum(Enum):
    admin = "admin"
    normal = "normal"


class ModelWithConfig(BaseModel):
    role: Optional[RoleEnum] = None
// ... (254 more lines)

Domain

Subdomains

Dependencies

Frequently Asked Questions

What does test_jsonable_encoder.py do?
test_jsonable_encoder.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_jsonable_encoder.py?
test_jsonable_encoder.py defines 24 function(s): test_custom_encoders, test_custom_enum_encoders, test_decimal_encoder_float, test_decimal_encoder_infinity, test_decimal_encoder_int, test_decimal_encoder_nan, test_encode_class, test_encode_custom_json_encoders_model_pydanticv2, test_encode_dataclass, test_encode_deque_encodes_child_models, and 14 more.
What does test_jsonable_encoder.py depend on?
test_jsonable_encoder.py imports 16 module(s): PydanticV1NotSupportedError, __init__.py, collections, dataclasses, datetime, decimal, encoders.py, enum, and 8 more.
Where is test_jsonable_encoder.py in the architecture?
test_jsonable_encoder.py is located at tests/test_jsonable_encoder.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