MCPcopy Index your code
hub / github.com/fastapi/sqlmodel / test_alias_generator_works_sqlmodel_v2

Function test_alias_generator_works_sqlmodel_v2

tests/test_aliases.py:162–170  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160
161
162def test_alias_generator_works_sqlmodel_v2():
163 class M(SQLModel):
164 model_config = {"alias_generator": lambda s: "gen_" + s}
165 f: str = Field()
166
167 m = M.model_validate({"gen_f": "ok"})
168 assert m.f == "ok"
169 data = m.model_dump(by_alias=True)
170 assert "gen_f" in data and data["gen_f"] == "ok"
171
172
173def test_alias_generator_with_explicit_alias_prefers_field_alias_sqlmodel_v2():

Callers

nothing calls this directly

Calls 2

model_validateMethod · 0.80
model_dumpMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…