diffie-hellman: add test template #2203
Conversation
Split to_snake into two functions Register to_snake_base macro
yawpitch
left a comment
There was a problem hiding this comment.
Well done on the template, but it's not exactly obvious from the docstrings that to_snake_base isn't converting whitespace and punctuation, while to_snake is ...
Consider instead something like:
def to_snake(string, wordchars_only=False):
"""
Converts pretty much anything to snake case.
By default whitespace and punctuation will be converted to underscores as well, pass wordchars_only=True to preserve these as is.
"""
[...]Then only the one filter is required and when needed it can be called with | to_snake(wordchars_only=True)?
Yeah I'll try that out. Wasn't quite sure how would that work with Jinja2 |
Remove to_snake base If wordchars_only argument is True to_snake function will not replace punctuation and whitespace characters with underscore
pyropy
left a comment
There was a problem hiding this comment.
I've deleted to_snake_base function and added suggested changes
yawpitch
left a comment
There was a problem hiding this comment.
That's great, keeps the generator itself much cleaner. I've flagged a couple of small additional changes, now that I've had a chance to look more closely at the template.
Add comment to random private key test Replace for loop with list comphrenhension
yawpitch
left a comment
There was a problem hiding this comment.
With the resolutions to @cmccandless comments I'd say this is now good, but I'll wait for a second before merge.
-Add jinja2 test template for Diffie Hellman exercise #1944
to_snakeinto two functions (to_snake_baseandto_snake)to_snake_basejinja2 macro