factory_boy
factory_boy copied to clipboard
Add failing test for traits chaining along with RelatedFactory and SubFactory
I found this bug and I made a PR to add a failing test.
According to the doc we should be allowed to chain Traits.
However when chaining traits we cannot have a reference to a SubFactory of a RelatedFactory.
The error I get is:
factory.errors.InvalidDeclarationError: Received deep context for unknown fields: {'nested__two': Maybe(<SelfAttribute('with_related_nested_override', default=False)>, yes=2, no=<factory.declarations.Skip object at 0x103bcd040>)} (known=[])
Sweet, thanks for taking the time to submit this report with an example to reproduce! :star: It definitely increases the chances of someone picking this up, and clarifies the issue.
The fix might also solve #533, or #542.
This suggested solution of #542 does not fix the problem and results in an additional failing test.