MCPcopy
hub / github.com/pydantic/pydantic / test_plugin_path_dataclass

Function test_plugin_path_dataclass

tests/test_plugins.py:338–354  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

336
337
338def test_plugin_path_dataclass() -> None:
339 class CustomOnValidatePython(ValidatePythonHandlerProtocol):
340 pass
341
342 class Plugin:
343 def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
344 assert schema_type.__name__ == 'Bar'
345 assert schema_type_path == SchemaTypePath('tests.test_plugins', 'test_plugin_path_dataclass.<locals>.Bar')
346 assert schema_kind == 'dataclass'
347 return CustomOnValidatePython(), None, None
348
349 plugin = Plugin()
350 with install_plugin(plugin):
351
352 @dataclasses.dataclass
353 class Bar:
354 a: int
355
356
357def test_plugin_path_type_adapter() -> None:

Callers

nothing calls this directly

Calls 2

install_pluginFunction · 0.85
PluginClass · 0.70

Tested by

no test coverage detected