diff options
Diffstat (limited to 'docs')
-rw-r--r-- | docs/reference.rst | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/docs/reference.rst b/docs/reference.rst index 81aa645..ad91a8d 100644 --- a/docs/reference.rst +++ b/docs/reference.rst @@ -586,7 +586,7 @@ handles more complex cases: SubFactory """""""""" -.. class:: SubFactory(sub_factory, **kwargs) +.. class:: SubFactory(factory, **kwargs) .. OHAI_VIM** @@ -601,6 +601,18 @@ The :class:`SubFactory` attribute should be called with: factory +.. note:: When passing an actual :class:`~factory.Factory` for the + :attr:`~factory.SubFactory.factory` argument, make sure to pass + the class and not instance (i.e no ``()`` after the class): + + .. code-block:: python + + class FooFactory(factory.Factory): + FACTORY_FOR = Foo + + bar = factory.SubFactory(BarFactory) # Not BarFactory() + + Definition ~~~~~~~~~~ @@ -1040,6 +1052,18 @@ RelatedFactory keyword: +.. note:: When passing an actual :class:`~factory.Factory` for the + :attr:`~factory.RelatedFactory.factory` argument, make sure to pass + the class and not instance (i.e no ``()`` after the class): + + .. code-block:: python + + class FooFactory(factory.Factory): + FACTORY_FOR = Foo + + bar = factory.RelatedFactory(BarFactory) # Not BarFactory() + + .. code-block:: python class CityFactory(factory.Factory): |