MCPcopy
hub / github.com/fastapi/fastapi / test_encode_dict

Function test_encode_dict

tests/test_jsonable_encoder.py:75–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

73
74
75def test_encode_dict():
76 pet = {"name": "Firulais", "owner": {"name": "Foo"}}
77 assert jsonable_encoder(pet) == {"name": "Firulais", "owner": {"name": "Foo"}}
78 assert jsonable_encoder(pet, include={"name"}) == {"name": "Firulais"}
79 assert jsonable_encoder(pet, exclude={"owner"}) == {"name": "Firulais"}
80 assert jsonable_encoder(pet, include={}) == {}
81 assert jsonable_encoder(pet, exclude={}) == {
82 "name": "Firulais",
83 "owner": {"name": "Foo"},
84 }
85
86
87def test_encode_dict_include_exclude_list():

Callers

nothing calls this directly

Calls 1

jsonable_encoderFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…