-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
Factory Boy requires a model to define a factory, however sometimes there's a need of taking advantage of the factory boy functionality without a model.
Requirements
Add an entry under Factory boy, where a solution such as the one below is presented.
from typing import NamedTuple
import factory
class TestUser(NamedTuple):
id: int
name: str
class TestUserFactory(factory.Factory):
class Meta:
model = TestUser
id = factory.Sequence(lambda n: 1000 + n)
name = factory.Faker('name')Acceptance Criteria
Provide a complete example
tuf = TestUserFactory()and
tuf = TestUserFactory(name="John O'Reilly")Metadata
Metadata
Assignees
Labels
No labels