add tests

This commit is contained in:
Waylon Walker 2023-04-28 21:11:48 -05:00
parent 5ae6b86712
commit ab0cd3e664
No known key found for this signature in database
GPG key ID: 66E2BF2B4190EFE4
3 changed files with 170 additions and 15 deletions

View file

@ -11,6 +11,7 @@ Classes:
from typing import Optional
from polyfactory.factories.pydantic_factory import ModelFactory
from pydantic import BaseModel, Field
@ -68,7 +69,7 @@ class Person(BaseModel):
...,
description="The name of the person.",
)
other_name: Optional[str] = Field(
alias: Optional[str] = Field(
None,
description="An optional other name for the person.",
)
@ -92,3 +93,31 @@ class Person(BaseModel):
...,
description="The person's hair.",
)
class AlphaFactory(ModelFactory[Alpha]):
"""A class for generating an alpha value."""
__model__ = Alpha
class ColorFactory(ModelFactory[Color]):
"""A class for generating a color."""
__model__ = Color
class HairFactory(ModelFactory[Hair]):
"""A class for generating hair."""
__model__ = Hair
class PersonFactory(ModelFactory[Person]):
"""A class for generating a person."""
__model__ = Person