MCPcopy
hub / github.com/pydantic/pydantic / test_json_ensure_ascii

Function test_json_ensure_ascii

tests/test_json.py:580–588  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

578
579# Complete tests exist in pydantic-core:
580def test_json_ensure_ascii() -> None:
581 ta = TypeAdapter(str)
582
583 assert ta.dump_json('à', ensure_ascii=True) == b'"\\u00e0"'
584
585 class Model(BaseModel):
586 f: str
587
588 assert Model(f='à').model_dump_json(ensure_ascii=True) == '{"f":"\\u00e0"}'

Callers

nothing calls this directly

Calls 4

dump_jsonMethod · 0.95
TypeAdapterClass · 0.90
model_dump_jsonMethod · 0.80
ModelClass · 0.70

Tested by

no test coverage detected