Created
December 29, 2012 14:15
-
-
Save dahlia/4407166 to your computer and use it in GitHub Desktop.
Jinja2 htmlfill ext
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# htmlfill | |
with app.test_request_context('/'): | |
html = render_template_string(''' | |
{%- autoescape true -%} | |
{%- form 'user.signup' with {'a': 123, 'b': 456} -%} | |
<input type="number" name="a"> {{- '' -}} | |
<input type="number" name="b" value="2"> {{- '' -}} | |
<input type="number" name="c" value="3"> | |
{%- endform -%} | |
{%- endautoescape -%} | |
''') | |
expected = ('<form action="/users/" method="POST">' | |
'<input type="number" name="a" value="123">' | |
'<input type="number" name="b" value="456">' | |
'<input type="number" name="c" value=""></form>') | |
assert html == expected |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment