MCPcopy
hub / github.com/pydantic/pydantic / CustomOnValidatePython

Class CustomOnValidatePython

tests/test_plugins.py:127–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125
126def test_on_validate_python_on_success() -> None:
127 class CustomOnValidatePython(ValidatePythonHandlerProtocol):
128 def on_enter(
129 self,
130 input: Any,
131 *,
132 strict: bool | None = None,
133 extra: ExtraValues | None = None,
134 from_attributes: bool | None = None,
135 context: Any | None = None,
136 self_instance: Any | None = None,
137 by_alias: bool | None = None,
138 by_name: bool | None = None,
139 ) -> None:
140 assert input == {'a': 1}
141 assert strict is None
142 assert extra is None
143 assert context is None
144 assert self_instance is None
145
146 def on_success(self, result: Any) -> None:
147 assert isinstance(result, Model)
148
149 class Plugin:
150 def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):

Callers 3

new_schema_validatorMethod · 0.85
new_schema_validatorMethod · 0.85
new_schema_validatorMethod · 0.85

Calls

no outgoing calls

Tested by 3

new_schema_validatorMethod · 0.68
new_schema_validatorMethod · 0.68
new_schema_validatorMethod · 0.68