(create_module)
| 352 | |
| 353 | |
| 354 | def test_recursive(create_module): |
| 355 | module = create_module( |
| 356 | # language=Python |
| 357 | """ |
| 358 | from __future__ import annotations |
| 359 | from typing import Optional |
| 360 | from pydantic import BaseModel |
| 361 | |
| 362 | class Model(BaseModel): |
| 363 | value: int |
| 364 | nested: Optional[Model] = None |
| 365 | """ |
| 366 | ) |
| 367 | M = module.Model |
| 368 | |
| 369 | assert M(value=1, nested=M(value=2)).model_dump_json(exclude_none=True) == '{"value":1,"nested":{"value":2}}' |
| 370 | |
| 371 | |
| 372 | def test_resolve_ref_schema_recursive_model(): |
nothing calls this directly
no test coverage detected