def test_template_formatting_from_string(app): """Test formatting of string-based template to string.""" with app.app_context(): out = render_template_to_string("foobar: {{ baz }}", _from_string=True, **{'baz': 'spam'}) assert out == 'foobar: spam'
def format_item(item, template, name='item'): """Render a template to a string with the provided item in context.""" ctx = {name: item} return render_template_to_string(template, **ctx)
def format_item(item, template, name='item'): """Render a template to a string with the provided item in context.""" ctx = {name: item} return render_template_to_string(template, **ctx)
def test_template_formatting_from_string(app): """Test formatting of string-based template to string.""" with app.app_context(): out = render_template_to_string("foobar: {{ baz }}", _from_string=True, **{'baz': 'spam'}) assert out == 'foobar: spam'