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
Support django's URLField #1388
Comments
Indeed I made urls strategy once upon a time: https://gist.github.com/kxepal/bceffb0f909a2339449f1e258d0fd433 (sorry for unittest, this code is about three years old). Do we want to have such strategy out of the box? I could try to bring that code back to live and contribute it. |
I'd be keen. Also, feel free to submit an initial low-pass version which you can refine later. As long as we get the API right up front, the implementation only needs to be good enough to be useful! |
We can also put a prototype |
Hey there! |
Go for it! Feel free to ping me if you get stuck 😄 Per our usual policy, the issue is yours for a week before it's open to anyone again. |
Hey @Zac-HD! What I have added:
What I haven't done:
For the hosts, I'm reusing the Things I am not sure about
|
Nice! I'd suggest opening a PR with this and the Django connection too 😄 I'll have some comments on the detail later, but overall this is a perfect example of a provisional strategy - not perfect, but much better than the status quo (and we can always improve it later). IMO it's better than the domains strategy! |
Closed by #1736 🎉 |
While using
hypothesis
quite successfully for mydjango
apps, I have faced a minor issue withURLField
.Currently it is impossible to generate random URLs with
hypothesis
. AndURLField
is not supported.Here's my example:
Which gives me this error:
Current solution
I am using a workaround with
faker
:After this fix it works, but it feels like some dirty hack.
Desired solution
I guess, it would be great to have
st.urls()
to generate URLs with corner cases.And also map this strategy right to the
django
'sURLField
by default.I know that @kxepal has some working prototype that does exactly that.
The text was updated successfully, but these errors were encountered: