MCPcopy
hub / github.com/pydantic/pydantic / test_create_model_test

Function test_create_model_test

tests/test_docs_extraction.py:396–416  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

394
395
396def test_create_model_test():
397 # Duplicate class creation to ensure create_model
398 # doesn't fallback to using inspect, which could
399 # in turn use the wrong class:
400 class MyModel(BaseModel):
401 foo: str = '123'
402 """Shouldn't be used"""
403
404 model_config = ConfigDict(
405 use_attribute_docstrings=True,
406 )
407
408 assert MyModel.model_fields['foo'].description == "Shouldn't be used"
409
410 MyModel = create_model(
411 'MyModel',
412 foo=(int, 123),
413 __config__=ConfigDict(use_attribute_docstrings=True),
414 )
415
416 assert MyModel.model_fields['foo'].description is None
417
418
419def test_exec_cant_be_parsed():

Callers

nothing calls this directly

Calls 2

create_modelFunction · 0.90
ConfigDictClass · 0.90

Tested by

no test coverage detected