| Commit message (Collapse) | Author | Age |
|
|
|
|
|
| |
Based on a boolean flag, those will alter the definitions of the current
factory, taking precedence over pre-defined behavior but overridden by
callsite-level arguments.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This handles parameters that alter the declarations of a factory.
A few technical notes:
- A parameter's outcome may alter other parameters
- In order to fix that, we perform a (simple) cyclic definition
detection at class declaration time.
- Parameters may only be either naked values or ComplexParameter
subclasses
- Parameters are never passed to the underlying class
|
|\
| |
| | |
Clarify sequence behavior on inheritance
|
| |
| |
| | |
Sequences are only shared via inheritance if the model of the subclass is the same as or a subclass of the model of the parent class. Clarify the docs on this point.
|
| |
| |
| |
| | |
No need to wrap it in a lambda to strip the object argument from LazyAttribute or the sequence argument from Sequence.
|
|/ |
|
|
|
|
| |
Thanks a lot to Jeff Widman for spotting them!
|
| |
|
|
|
|
| |
As spotted by @proofit404
|
|
|
|
|
| |
This relies on the ``fake-factory`` library, and provides realistic
random values for most field types.
|
|
|
|
|
|
| |
Define ``Meta.rename = {'attrs': 'attributes'}``
if your model expects a ``attributes`` kwarg but you can't
define it since it's already reserved by the ``Factory`` class.
|
|
|
|
| |
Thanks to @DasAllFolks for spotting it!
|
| |
|
|
|
|
|
|
|
|
| |
Use ``obj`` for ``@post_generation``-decorated methods, instead of
``self``: this makes it clearer that the ``obj`` is an instance of the
model, and not of the ``Factory``.
Thanks to @jamescooke & @NiklasMM for spotting the typo.
|
| |
|
|
|
|
|
| |
This disables the ``FACTORY_FOR`` syntax and related parameters,
that should be declared through ``class Meta``.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
It will be automatically set to True if neither the Factory subclass nor
its parents define a FACTORY_FOR argument.
It can also be set on a Factory subclass to prevent it from being
called.
|
| |
|
|
|
|
| |
Thanks to @Dhekke for the help!
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Use less conflict-prone factory_related_name.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Fields listed in this class attributes will be removed from the
kwargs dict passed to the associated class for building/creation.
|
|
|
|
| |
Magic abuse is bad.
|
|
|
|
| |
Replace CircularSubFactory('module', 'symbol') with SubFactory('module.symbol').
|
|
|
|
| |
Use Iterator/iterator instead.
|
|
|
|
| |
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
| |
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
This merges in changes provided by gotgenes to the previous
PostGeneration documentation to the new documentation provided by
rbarrois. This documentation relates to the new functionality of
overriding default arguments to declarations of
PostGenerationMethodCall.
Signed-off-by: Raphaël Barrois <raphael.barrois@polyconseil.fr>
|
|
|
|
|
|
|
|
|
| |
This will be properly fixed in v2.0.0; the current heuristic is:
- If the user defined a custom _create method, use it
- If he didn't, but the associated class has a objects attribute, use TheClass.objects.create(*args, **kwargs)
- Otherwise, simply call TheClass(*args, **kwargs).
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
| |
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
|
|
| |
This was the last missing bit from PR#36 by @gotgenes.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
|
|
|
| |
This provides a consistent behaviour for extracting arguments to
a PostGenerationMethodCall.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
|
|
| |
Use it in DjangoModelFactory to save objects again if a post_generation hook ran.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
|
|
| |
This works exactly as for SubFactory.
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
| |
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Iterator now cycles by default
* Iterator can be provided with a custom getter
* SubFactory accepts a factory import path as well
Deprecates:
* InfiniteIterator
* CircularSubFactory
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|
|
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
|