()
| 464 | |
| 465 | |
| 466 | def test_plugin_path_complex() -> None: |
| 467 | paths: list[tuple(str, str)] = [] |
| 468 | |
| 469 | class CustomOnValidatePython(ValidatePythonHandlerProtocol): |
| 470 | pass |
| 471 | |
| 472 | class Plugin: |
| 473 | def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings): |
| 474 | paths.append((schema_type.__name__, schema_type_path, schema_kind)) |
| 475 | return CustomOnValidatePython(), None, None |
| 476 | |
| 477 | plugin = Plugin() |
| 478 | with install_plugin(plugin): |
| 479 | |
| 480 | def foo(): |
| 481 | class Model1(BaseModel): |
| 482 | pass |
| 483 | |
| 484 | def bar(): |
| 485 | class Model2(BaseModel): |
| 486 | pass |
| 487 | |
| 488 | foo() |
| 489 | bar() |
| 490 | |
| 491 | assert paths == [ |
| 492 | ( |
| 493 | 'Model1', |
| 494 | SchemaTypePath('tests.test_plugins', 'test_plugin_path_complex.<locals>.foo.<locals>.Model1'), |
| 495 | 'BaseModel', |
| 496 | ), |
| 497 | ( |
| 498 | 'Model2', |
| 499 | SchemaTypePath('tests.test_plugins', 'test_plugin_path_complex.<locals>.bar.<locals>.Model2'), |
| 500 | 'BaseModel', |
| 501 | ), |
| 502 | ] |
nothing calls this directly
no test coverage detected