Home / Function/ test_encode_dataclass() — fastapi Function Reference

test_encode_dataclass() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

tests/test_jsonable_encoder.py lines 125–131

def test_encode_dataclass():
    item = Item(name="foo", count=100)
    assert jsonable_encoder(item) == {"name": "foo", "count": 100}
    assert jsonable_encoder(item, include={"name"}) == {"name": "foo"}
    assert jsonable_encoder(item, exclude={"count"}) == {"name": "foo"}
    assert jsonable_encoder(item, include={}) == {}
    assert jsonable_encoder(item, exclude={}) == {"name": "foo", "count": 100}

Domain

Subdomains

Frequently Asked Questions

What does test_encode_dataclass() do?
test_encode_dataclass() is a function in the fastapi codebase, defined in tests/test_jsonable_encoder.py.
Where is test_encode_dataclass() defined?
test_encode_dataclass() is defined in tests/test_jsonable_encoder.py at line 125.
What does test_encode_dataclass() call?
test_encode_dataclass() 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