-
Notifications
You must be signed in to change notification settings - Fork 392
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow nesting declarations in Faker params.
A `factory.Faker()` call may accept extra keywords, as required by its provider. This change allows using any factory-supported declaration (`SelfAttribute`, fuzzy, other faker calls). This is built through a new class, `ParameteredDeclaration`, which holds all the specific code for lazily evaluating parameters to a declaration. That class replaces `ParameteredAttribute` in other fields with a similar behaviour, namely `django.FileField` and `django.ImageField`. The `ParameteredAttribute` internal class, while similar, is kept, as it provides a dedicated support for `SubFactory` and might be used for other declarations relying on a custom factory. Moreover, although part of the private API, it is already relied upon by other projects [1]. Once `ParameteredDeclaration`' API is stabilised, it could be documented as a formal extension point for custom declarations. [1] https://github.com/mvantellingen/wagtail-factories/blob/master/src/wagtail_factories/blocks.py#L20
- Loading branch information
Showing
6 changed files
with
145 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters