djangofactory-boy

Factory Boy FuzzySubFactory available?


I am wondering if there is something like FuzzyChoice for Objects.

Background is that I have a base factory and 3 different implementations. Another Factory which uses these factories should randomly choose one of the three implementations. So I did not found that specify FuzzySubFactory within the docs but is there another way to achieve this?

Thanks and regards Matt


Solution

  • You can just define a list with the desired factories and the use python buidl-in random.choice(items).