Skip to content

phha/unifactory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unifactory

Unifactory is a spin off from fastapi-overrider. A simple tool to automatically choose a matching factory from polyfactory's inventory.

Installation

pip install unifactory

Examples

from polyfactory.pytest_plugin import register_fixture
from unifactory import unifactory, build, batch, coverage

@dataclass
class Person:
    name: str
    age: float
    height: float
    weight: float

some_person = build(Person)
five_persons = batch(Person, 5)
all_persons = coverage(Person)
person_factory = register_fixture(unifactory(Person), name="person_factory")