MCPcopy
hub / github.com/pydantic/pydantic / test_plugin_path_create_model

Function test_plugin_path_create_model

tests/test_plugins.py:449–463  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

447
448
449def test_plugin_path_create_model() -> None:
450 class CustomOnValidatePython(ValidatePythonHandlerProtocol):
451 pass
452
453 class Plugin:
454 def new_schema_validator(self, schema, schema_type, schema_type_path, schema_kind, config, plugin_settings):
455 assert schema_type.__name__ == 'FooModel'
456 assert list(schema_type.model_fields.keys()) == ['foo', 'bar']
457 assert schema_type_path == SchemaTypePath('tests.test_plugins', 'FooModel')
458 assert schema_kind == 'create_model'
459 return CustomOnValidatePython(), None, None
460
461 plugin = Plugin()
462 with install_plugin(plugin):
463 create_model('FooModel', foo=(str, ...), bar=(int, 123))
464
465
466def test_plugin_path_complex() -> None:

Callers

nothing calls this directly

Calls 3

create_modelFunction · 0.90
install_pluginFunction · 0.85
PluginClass · 0.70

Tested by

no test coverage detected