-
Notifications
You must be signed in to change notification settings - Fork 13
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
Produce a sample that does not match a regex #36
Comments
Hello @spacether . Thank you for your ticket. Solution: Suppose we have a regex: I would then separate this regex into 2 parts: To produce string that does not match the initial pattern I will;
This approach should produce strings that will partially match the regex. I have not yet deep dived into this approach, so there might be some underwater stones, but generally it looks promising for me. Is that approach clear for you? Do you think that will suite your needs? |
Yup, I think that that approach will suit my needs. These not matching negative use cases are a nice to have for the future. If our pattern is: Will your solution always give the same result for the first non matching sample? |
In current implementation you can provide initialized You can refer to this test case. Random 3 character long string will be deterministic because randomness of this string will be defined by some of the pseudo-random values generators, e.g. |
That works great; thank you! |
First steps. Disabled performance tests for now.
Step 3. Implemented some of nodes and tests.
Step 4. In reality i need to only implement terminal nodes. Container nodes should work, because they will use terminal nodes inside.
Step 5. More tests and implementations.
Refactoring. Logging really is not needed clean up to make library smaller.
Implementation of Choice and other final steps.
Fixed complex expressions groups generation.
…ring #36 Generate not matching string
Hello. I've completed implementation for the feature requested. If something is not working or any additional features are needed - please open another ticket. I did not implement any customization for now - from your description i understand it is not very important and this will require big overhead also. |
Thank you! Openapi generator is now using your package to generate matching regex examples for the python-experimental generator OpenAPITools/openapi-generator#7157 |
That is great! Thank you. It's always nice to know that someone uses your work 👍 |
Thank you so much for this package!
It looks great and I am looking forward to seeing if I can use it to generate regex samples for api documentation and test generation.
Is your feature request related to a problem? Please describe.
One can generate strings that do match a regex pattern but can it generate a string that does not match a pattern?
Your code lets us test a positive use case. If you provide a sample_does_not_match_pattern functionality then we can test the negative use case too.
Describe the solution you'd like
Could a method or function be created to produce a sample that does not match a regex pattern?
Describe alternatives you've considered
Randomly generating strings until a non matching sample is found.
But that is non-deterministic and is brute forcing the problem.
Additional context
I am considering using this library in https://github.com/OpenAPITools/openapi-generator
The text was updated successfully, but these errors were encountered: