You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The strategy names build and create are not distinct enough in meaning from each other. This means it's hard to remember which does what. In an informal slack poll at my workplace, ~10% of developers agreed with me that they needed to look up the documentation frequently to be sure they were correct. I have worked extensively on the project https://github.com/wagtail/wagtail-factories, so consider myself reasonably familiar with factory_boy, but struggle to remember which strategy is which!
Proposed solution
I would love to see aliases to the .build and .create methods in factory_boy that more explicitly communicate what they do. Off the top of my head, .in_memory and .persist seem like reasonable options, but I'm open to bikeshedding.
I am happy to contribute a PR to this effect if this is agreeable.
The text was updated successfully, but these errors were encountered:
I don't think creating aliases would be the way to go; in my experience, it doesn't add any benefit and confuse people even more. Users discovering the library will want to know the different between build and in_memory (or create and persist) just to discover they mean the same thing.
However, I think the docstrings could be improved. If you are using an IDE with a LSP integration, you'll be able to know which method is doing what:
The problem
The strategy names
build
andcreate
are not distinct enough in meaning from each other. This means it's hard to remember which does what. In an informal slack poll at my workplace, ~10% of developers agreed with me that they needed to look up the documentation frequently to be sure they were correct. I have worked extensively on the project https://github.com/wagtail/wagtail-factories, so consider myself reasonably familiar withfactory_boy
, but struggle to remember which strategy is which!Proposed solution
I would love to see aliases to the
.build
and.create
methods infactory_boy
that more explicitly communicate what they do. Off the top of my head,.in_memory
and.persist
seem like reasonable options, but I'm open to bikeshedding.I am happy to contribute a PR to this effect if this is agreeable.
The text was updated successfully, but these errors were encountered: