summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaphaël Barrois <raphael.barrois@polytechnique.org>2012-02-24 00:17:04 +0100
committerRaphaël Barrois <raphael.barrois@polytechnique.org>2012-02-24 00:17:04 +0100
commit826312ad0629ab49cab436d7cb1d27a898e7d864 (patch)
treea601961ade8173ce06c348acbd5ca949041b1896
parent2a1138550b3220b6f8cd23bae5fed03f0fb448cf (diff)
downloadfactory-boy-826312ad0629ab49cab436d7cb1d27a898e7d864.tar
factory-boy-826312ad0629ab49cab436d7cb1d27a898e7d864.tar.gz
Improve documentation.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
-rw-r--r--factory/containers.py4
-rw-r--r--factory/declarations.py13
2 files changed, 15 insertions, 2 deletions
diff --git a/factory/containers.py b/factory/containers.py
index ef97548..fda9073 100644
--- a/factory/containers.py
+++ b/factory/containers.py
@@ -45,6 +45,10 @@ class LazyStub(object):
__values (dict): maps attribute name to computed value
__pending (str list): names of the attributes whose value is being
computed. This allows to detect cyclic lazy attribute definition.
+ __containers (LazyStub list): "parents" of the LazyStub being built.
+ This allows to have the field of a field depend on the value of
+ another field
+ __target_class (type): the target class to build.
"""
__initialized = False
diff --git a/factory/declarations.py b/factory/declarations.py
index 60425c3..08598e5 100644
--- a/factory/declarations.py
+++ b/factory/declarations.py
@@ -155,8 +155,9 @@ class ContainerAttribute(OrderedDeclaration):
Args:
obj (LazyStub): a lazy stub of the object being constructed, if
needed.
- containers (LazyStub): a lazy stub of a factory being evaluated, with
- a SubFactory building 'obj'.
+ containers (list of LazyStub): a list of lazy stubs of factories
+ being evaluated in a chain, each item being a future field of
+ next one.
"""
if self.strict and not containers:
raise TypeError(
@@ -187,6 +188,14 @@ class SubFactory(OrderedDeclaration):
- attributes defined in the wrapped factory class
- values defined when defining the SubFactory
- additional values defined in attributes
+
+ Args:
+ create (bool): whether the subfactory should call 'build' or
+ 'create'
+ extra (containers.DeclarationDict): extra values that should
+ override the wrapped factory's defaults
+ containers (list of LazyStub): List of LazyStub for the chain of
+ factories being evaluated, the calling stub being first.
"""
defaults = dict(self.defaults)