-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add URL and DomainName generators #17
Comments
Can you please tell what is your use case, and how configurable the generation should be, in your opinion? I don't have much experience using the hypothesis domain/URL generators. |
I want to test some code that parses a string as a URL in order to separate the scheme/host/port from the path, dropping any queries or fragments. I used the hypothesis URL strategy in another project, and thought it would make a reasonable addition to rapid. As for an API, the domain strategy takes arguments for maximum length (total characters) and maximum elements (total domain segments), which seems reasonable. If a user needed to enforce a minimum for either property, writing a For the URL generator, I was thinking it should return a So in very rough pseudocode: func Domain(maxLength, maxElements int) *Generator // cast generated values to string
func URL() *Generator // cast generated values to *url.URL I can't think of any customizations for URL generation or alternative generators that wouldn't be easily done via a |
Does this seem reasonable? I can start a pull request so we can look at some actual code. |
Looks reasonable, PR would be great! I'd avoid any parameters in For |
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes flyingmutant#17 Signed-off-by: Walter Scheper <ratlaw@gmail.com>
Finally got around to trying to implement this. Not completely sure I'm using the best implementation here, as I'm not completely sure how to use some of the internal bits of rapid. Any suggestions for improvement are welcome. I opted for The option to generate URLs with schemes other than http/https is available in the private implementation, but I didn't bother to expose it through a public API. If you prefer the Domain generator follow that pattern, I can easily remove the |
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes flyingmutant#17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes flyingmutant#17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes #17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes flyingmutant#17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes #17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes flyingmutant#17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
This adds a Generator for RFC 3986 compliant URLs, and two generators for RFC 1035 compliant domain names. Closes flyingmutant#17 Signed-off-by: Walter Scheper <walter.scheper@gmail.com>
Generating proper URLs is tricky, and seems like something a library like rapid should provide. The implementation in hypothesis seems like a good starting point, though the URL generator is limited to http(s) schemes.
The text was updated successfully, but these errors were encountered: