MCPcopy
hub / github.com/pydantic/pydantic / test_sequences_int_json_schema

Function test_sequences_int_json_schema

tests/test_json_schema.py:5284–5300  ·  view source on GitHub ↗
(sequence_type)

Source from the content-addressed store, hash-verified

5282
5283@pytest.mark.parametrize(('sequence_type',), [pytest.param(list), pytest.param(Sequence)])
5284def test_sequences_int_json_schema(sequence_type):
5285 class Model(BaseModel):
5286 int_seq: sequence_type[int]
5287
5288 assert Model.model_json_schema() == {
5289 'title': 'Model',
5290 'type': 'object',
5291 'properties': {
5292 'int_seq': {
5293 'title': 'Int Seq',
5294 'type': 'array',
5295 'items': {'type': 'integer'},
5296 },
5297 },
5298 'required': ['int_seq'],
5299 }
5300 assert Model.model_validate_json('{"int_seq": [1, 2, 3]}')
5301
5302
5303@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 2

model_validate_jsonMethod · 0.80
model_json_schemaMethod · 0.45

Tested by

no test coverage detected