1515 TypeTestModel as TypeTestModelBase , ValidatedUser as ValidatedUserBase ,
1616 TypeAdapterTest as TypeAdapterTestBase , YesOrNoBooleanAdapter ,
1717 MappedUser as MappedUserBase , MappedPost as MappedPostBase , MappedComment as MappedCommentBase ,
18- ColumnMappingModel as ColumnMappingModelBase , MixedAnnotationModel as MixedAnnotationModelBase
18+ ColumnMappingModel as ColumnMappingModelBase , MixedAnnotationModel as MixedAnnotationModelBase ,
19+ PydanticValidatedModel as PydanticValidatedModelBase ,
1920)
2021from rhosocial .activerecord .testsuite .feature .basic .fixtures .models import (
2122 AsyncUser as AsyncUserBase , AsyncTypeCase as AsyncTypeCaseBase ,
2223 AsyncValidatedUser as AsyncValidatedUserBase , AsyncValidatedFieldUser as AsyncValidatedFieldUserBase ,
2324 AsyncTypeTestModel as AsyncTypeTestModelBase , AsyncTypeAdapterTest as AsyncTypeAdapterTestBase ,
2425 AsyncMappedUser as AsyncMappedUserBase , AsyncMappedPost as AsyncMappedPostBase ,
2526 AsyncMappedComment as AsyncMappedCommentBase ,
26- AsyncColumnMappingModel as AsyncColumnMappingModelBase , AsyncMixedAnnotationModel as AsyncMixedAnnotationModelBase
27+ AsyncColumnMappingModel as AsyncColumnMappingModelBase , AsyncMixedAnnotationModel as AsyncMixedAnnotationModelBase ,
28+ AsyncPydanticValidatedModel as AsyncPydanticValidatedModelBase ,
2729)
2830from rhosocial .activerecord .testsuite .feature .basic .fixtures .models import (
2931 BulkUser as BulkUserBase , AsyncBulkUser as AsyncBulkUserBase
@@ -143,6 +145,8 @@ def _select_model_class(base_cls, py312_cls, py311_cls, py310_cls, model_name: s
143145AsyncMixedAnnotationModel = _select_model_class (AsyncMixedAnnotationModelBase , AsyncMixedAnnotationModel312 , AsyncMixedAnnotationModel311 , AsyncMixedAnnotationModel310 , "AsyncMixedAnnotationModel" )
144146BulkUser = BulkUserBase
145147AsyncBulkUser = AsyncBulkUserBase
148+ PydanticValidatedModel = PydanticValidatedModelBase
149+ AsyncPydanticValidatedModel = AsyncPydanticValidatedModelBase
146150
147151from rhosocial .activerecord .testsuite .feature .basic .interfaces import IBasicProvider
148152from rhosocial .activerecord .testsuite .core .protocols import WorkerTestProtocol
@@ -360,6 +364,12 @@ async def setup_async_type_adapter_model_and_schema(self, scenario_name: Optiona
360364 scenario_name = self .get_test_scenarios ()[0 ] if self .get_test_scenarios () else "default"
361365 return await self ._setup_async_model (AsyncTypeAdapterTest , scenario_name , "type_adapter_tests" )
362366
367+ def setup_pydantic_validated_model (self , scenario_name : str ) -> Type [ActiveRecord ]:
368+ return self ._setup_model (PydanticValidatedModel , scenario_name , "pydantic_validated_models" )
369+
370+ async def setup_async_pydantic_validated_model (self , scenario_name : str ) -> Type [ActiveRecord ]:
371+ return await self ._setup_async_model (AsyncPydanticValidatedModel , scenario_name , "pydantic_validated_models" )
372+
363373 def setup_bulk_user_model (self , scenario_name : str ) -> Type [ActiveRecord ]:
364374 """Sets up the database for the `BulkUser` model tests."""
365375 return self ._setup_model (BulkUser , scenario_name , "bulk_users" )
@@ -382,7 +392,8 @@ def cleanup_after_test(self, scenario_name: str):
382392 tables_to_drop = [
383393 'comments' , 'posts' , 'users' , 'type_cases' , 'type_tests' ,
384394 'validated_field_users' , 'validated_users' , 'type_adapter_tests' ,
385- 'column_mapping_items' , 'mixed_annotation_items' , 'bulk_users'
395+ 'column_mapping_items' , 'mixed_annotation_items' , 'bulk_users' ,
396+ 'pydantic_validated_models'
386397 ]
387398 for backend_instance in self ._active_backends :
388399 try :
@@ -404,7 +415,8 @@ async def cleanup_after_test_async(self, scenario_name: str):
404415 tables_to_drop = [
405416 'comments' , 'posts' , 'users' , 'type_cases' , 'type_tests' ,
406417 'validated_field_users' , 'validated_users' , 'type_adapter_tests' ,
407- 'column_mapping_items' , 'mixed_annotation_items' , 'bulk_users'
418+ 'column_mapping_items' , 'mixed_annotation_items' , 'bulk_users' ,
419+ 'pydantic_validated_models'
408420 ]
409421 for backend_instance in self ._active_async_backends :
410422 try :
0 commit comments