summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorHervé Cauwelier <herve.cauwelier@polyconseil.fr>2016-02-12 17:31:04 +0100
committerHervé Cauwelier <herve.cauwelier@polyconseil.fr>2016-02-12 17:31:04 +0100
commitf2c075c40fd331b7d26a9db72aad249b2165eac4 (patch)
tree9a9de1a7c1a608b40b2ec18610edad361be28602 /README.rst
parent38f4a69db8f71cb52b9e7fd8d6e20e7d052a5b8d (diff)
downloadfactory-boy-f2c075c40fd331b7d26a9db72aad249b2165eac4.tar
factory-boy-f2c075c40fd331b7d26a9db72aad249b2165eac4.tar.gz
factory: LazyFunction to just call a function in the simplest case
No need to wrap it in a lambda to strip the object argument from LazyAttribute or the sequence argument from Sequence.
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/README.rst b/README.rst
index 4d114e5..762fedb 100644
--- a/README.rst
+++ b/README.rst
@@ -226,6 +226,7 @@ These "lazy" attributes can be added as follows:
first_name = 'Joe'
last_name = 'Blow'
email = factory.LazyAttribute(lambda a: '{0}.{1}@example.com'.format(a.first_name, a.last_name).lower())
+ date_joined = factory.LazyFunction(datetime.now)
.. code-block:: pycon
@@ -233,6 +234,10 @@ These "lazy" attributes can be added as follows:
"joe.blow@example.com"
+.. note:: ``LazyAttribute`` calls the function with the object being constructed as an argument, when
+ ``LazyFunction`` does not send any argument.
+
+
Sequences
"""""""""