factory_boy
factory_boy copied to clipboard
Clarify deprecated parts in `factory.fuzzy`
The problem
Some of the features included in factory.fuzzy are now a duplicate of faker-provided items. But some don't have a satisfactory equivalent.
Proposed solution
- Describe what is, and isn't, deprecated;
- Clarify the differences
Extra notes
For instance:
factory.fuzzy.FuzzyChoiceis guaranteed to be lazy, whereasfactory.Faker('random_choice', elements=...)isn't — the latter might evaluate a queryset at import time;factory.fuzzy.FuzzyDateTimeis explicitly timezone-aware, whereas Faker defaults to naive datetime;- The current API for
factory.Fakermakes for less readable/IDE-compatible code compared tofactory.Fuzzy.
Moving forward:
- Generate equivalents based on Faker for those that have them and deprecate them: this would educate and flag for future removal
- Provide alternatives to Faker for things we'd like to behave differently or is non existent
- Finally, remove or shrink fuzzy
Sorry, my proposal (jotting this down before going into a meeting).
Faker is harder to use in factory.lazy_attribute, missing a fuzz() that can just be called, especially for types like dates that depend on each other to form a valid period, this is non obvious (still figuring that out).