-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PoC: a .optional proxy that may or may not return a fake value #1867
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you fix the missing type annotation?
Sorry for the delay! I was out of the country and it took me a bit of time to catch up with things. I've taken a slightly roundabout route because i assume you don't really want to have to pull in I've also fixed it so it the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thankyou! Could you quickly run make lint
against the code?
Done! I'd run black, but with the wrong line length. Sorry about that! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Haven't you considered also adding a |
What does this change
This adds a
.optional
property, that should make all the usual functions return either a fake value orNone
, with a customisable probability.This was a quick and dirty lunchtime project which could use some care and attention (in particular I'm not sure about the
prob=n
parameter, and the tests are a bit limited). I thought I'd get some feedback before spending too much time cleaning it up.What was wrong
Currently it can be a bit fiddly to create fake optional fake data. There are a few projects out there that extend
faker
to provide this functionality using custom providers, but they're limited in what they can generate. This provides access to everything that would normally be available.