Extensions for Factory Boy
Factory-Man provides extensions for Factory Boy.
factory.Sequence to provide a little more DRY syntax. It takes in a
string parameter and uses it to create a unique value for each object by adding
-n to the string, where
n is the count of objects created.
When working with Django,
ModelFieldSequence can also accept a
model parameter instead of
model should be a Django model. The name of the model and the field to which
ModelFieldSequence is signed to are used to automatically create the
model can also be used as a positional argument.
from factory.django import DjangoModelFactory as ModelFactory from factoryman import ModelFieldSequence class CharityFactory(ModelFactory): class Meta: model = Charity name = ModelFieldSequence(Charity) # Will be `Charity__name-n`, where n is the object count email = ModelFieldSequence(email@example.com') # Will be `firstname.lastname@example.org`, where n is the object count
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Hashes for factory_man-0.1.0-py3-none-any.whl