()
| 394 | |
| 395 | |
| 396 | def 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 | |
| 419 | def test_exec_cant_be_parsed(): |
nothing calls this directly
no test coverage detected