Home / Function/ test_custom_enum_encoders() — fastapi Function Reference

test_custom_enum_encoders() — fastapi Function Reference

Architecture documentation for the test_custom_enum_encoders() function in test_jsonable_encoder.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  0a0f4896_9f25_ca4d_1895_60de9fb05351["test_custom_enum_encoders()"]
  80ce950d_4c72_e7d9_21bb_a5c60524786c["test_jsonable_encoder.py"]
  0a0f4896_9f25_ca4d_1895_60de9fb05351 -->|defined in| 80ce950d_4c72_e7d9_21bb_a5c60524786c
  1ac1bc37_1a47_e7e2_9156_ab0473094700["jsonable_encoder()"]
  0a0f4896_9f25_ca4d_1895_60de9fb05351 -->|calls| 1ac1bc37_1a47_e7e2_9156_ab0473094700
  style 0a0f4896_9f25_ca4d_1895_60de9fb05351 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

tests/test_jsonable_encoder.py lines 228–240

def test_custom_enum_encoders():
    def custom_enum_encoder(v: Enum):
        return v.value.lower()

    class MyEnum(Enum):
        ENUM_VAL_1 = "ENUM_VAL_1"

    instance = MyEnum.ENUM_VAL_1

    encoded_instance = jsonable_encoder(
        instance, custom_encoder={MyEnum: custom_enum_encoder}
    )
    assert encoded_instance == custom_enum_encoder(instance)

Domain

Subdomains

Frequently Asked Questions

What does test_custom_enum_encoders() do?
test_custom_enum_encoders() is a function in the fastapi codebase, defined in tests/test_jsonable_encoder.py.
Where is test_custom_enum_encoders() defined?
test_custom_enum_encoders() is defined in tests/test_jsonable_encoder.py at line 228.
What does test_custom_enum_encoders() call?
test_custom_enum_encoders() calls 1 function(s): jsonable_encoder.

Analyze Your Own Codebase

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

Try Supermodel Free