-
-
Notifications
You must be signed in to change notification settings - Fork 85
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 support for suffix
in seq
(fix #93)
#111
Conversation
- This adds a new `suffix` keyword arg to the `seq` function to allow the concatenation of a common suffix string onto a generated `seq` value. - This adds a section under "Sequences in recipes" to the documentation to provide example usage of the new keyword argument. - Additionally, an `email` field is added to the `Customer` example model in the README.md to go along with the new section in the documentation. - This also adds unit tests for the new keyword argument behavior.
- This also adds that example field to the other `Customer` class examples throughout the docs.
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.
Thanks for such a clean, testable and documented PR @timjklein36! I left 2 suggestion on how we can improve the error handling for this new parameter. Besides that, I'm all good with the code and the PR.
I'll wait for @anapaulagomes or @amureki to review it and as soon as we have an extra approval we can merge this.
… text sequence - Also, change the str test case to use Person.email field (to better match the example mock data).
@berinhard I updated the code based on your suggestions. Take a look at your earliest convenience. Thanks! |
- Removes unused variable in test method
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.
Looks great! Thanks =)
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.
Thanks for your contribution, @timjklein36! This is a really nice feature for seq
. 🌷
I left small comments but I'm not sure about the naming. I think end
would fit better than suffix
, only because we already have start
as a parameter of seq
. I'd love to hear your and @berinhard thoughts about it.
- Changes made based on code review suggestions
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.
Docstrings =)
@berinhard @anapaulagomes I added a |
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.
LGTM! 🎉
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.
Nice! Thanks =)
Add support for
suffix
inseq
(fix #93)What
This change introduces the ability to append a common suffix on to values generated by
seq
.Fixes #93
Why
Some fields may represent data that generally contains a common suffix, like in the case of emails. Mock data is therefore differentiated in the first portion of the field's value. An example of this:
By allowing an optionally supplied suffix, the
seq
function is able to append some common string onto its generated values.How
A
suffix
keyword argument was added to theseq
function to allow the concatenation of a common suffix string onto a generated value. This will not work with types ofvalue
other thanstr
. Tests have been added to cover the "happy" and some "sad" path use of the new keyword argument.Example:
This PR also adds a section under "Sequences in recipes" to the documentation to provide example usage of the new keyword argument. Additionally, an
email
field is added to theCustomer
example model in the README.md to go along with the new section in the documentation.Note: the line altered in
seq
(shown below) takes into account that if nosuffix
argument is supplied, it will essentially append an un-initialized type of the same as thevalue
input. For number types, this is equivalent to0
.