()
| 408 | |
| 409 | |
| 410 | def test_plugin_path_validate_call() -> None: |
| 411 | class CustomOnValidatePython(ValidatePythonHandlerProtocol): |
| 412 | pass |
| 413 | |
| 414 | class Plugin1: |
| 415 | def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings): |
| 416 | assert schema_type.__name__ == 'foo' |
| 417 | assert schema_type_path == SchemaTypePath( |
| 418 | 'tests.test_plugins', 'test_plugin_path_validate_call.<locals>.foo' |
| 419 | ) |
| 420 | assert schema_kind == 'validate_call' |
| 421 | return CustomOnValidatePython(), None, None |
| 422 | |
| 423 | plugin = Plugin1() |
| 424 | with install_plugin(plugin): |
| 425 | |
| 426 | @validate_call() |
| 427 | def foo(a: int): |
| 428 | return a |
| 429 | |
| 430 | class Plugin2: |
| 431 | def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings): |
| 432 | assert schema_type.__name__ == 'my_wrapped_function' |
| 433 | assert schema_type_path == SchemaTypePath( |
| 434 | 'tests.test_plugins', 'partial(test_plugin_path_validate_call.<locals>.my_wrapped_function)' |
| 435 | ) |
| 436 | assert schema_kind == 'validate_call' |
| 437 | return CustomOnValidatePython(), None, None |
| 438 | |
| 439 | plugin = Plugin2() |
| 440 | with install_plugin(plugin): |
| 441 | |
| 442 | def my_wrapped_function(a: int, b: int, c: int): |
| 443 | return a + b + c |
| 444 | |
| 445 | my_partial_function = partial(my_wrapped_function, c=3) |
| 446 | validate_call(my_partial_function) |
| 447 | |
| 448 | |
| 449 | def test_plugin_path_create_model() -> None: |
nothing calls this directly
no test coverage detected