Skip to content
Myr

Add test cases for quotes and expand coverage to include Markup input

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Erik Johnson · committed by Erik Johnson · parent e937c8a · Browse files · 1 file+17 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+17 added−6 removed

  • tests:+17 added−6 removed

1 file+17 added−6 removed

modified:tests/test_filters.py+17 added-6 removed
133 unmodified lines
134 tmpl = env.from_string('''{{ "%s|%s"|format("a", "b") }}''')135 out = tmpl.render()136 assert out == 'a|b'137138 def test_indent(self, env):139 text = '\n'.join(['', 'foo bar', ''])138 @staticmethod139 def _test_indent_multiline_template(env, markup=False):140 text = '\n'.join(['', 'foo bar', '"baz"', ''])141 if markup:142 text = Markup(text)143 t = env.from_string('{{ foo|indent(2, false, false) }}')141 assert t.render(foo=text) == '\n foo bar\n'144 assert t.render(foo=text) == '\n foo bar\n "baz"\n'145 t = env.from_string('{{ foo|indent(2, false, true) }}')143 assert t.render(foo=text) == '\n foo bar\n '146 assert t.render(foo=text) == '\n foo bar\n "baz"\n '147 t = env.from_string('{{ foo|indent(2, true, false) }}')145 assert t.render(foo=text) == ' \n foo bar\n'148 assert t.render(foo=text) == ' \n foo bar\n "baz"\n'149 t = env.from_string('{{ foo|indent(2, true, true) }}')147 assert t.render(foo=text) == ' \n foo bar\n '150 assert t.render(foo=text) == ' \n foo bar\n "baz"\n '151152 def test_indent(self, env):153 self._test_indent_multiline_template(env)154 t = env.from_string('{{ "jinja"|indent }}')155 assert t.render() == 'jinja'156 t = env.from_string('{{ "jinja"|indent(first=true) }}')157 assert t.render() == ' jinja'158 t = env.from_string('{{ "jinja"|indent(blank=true) }}')159 assert t.render() == 'jinja'160161 def test_indent_markup_input(self, env):162 '''163 Tests casses where the filter input is a Markup type164 '''165 self._test_indent_multiline_template(env, markup=True)166167 def test_indentfirst_deprecated(self, env):168 with pytest.warns(DeprecationWarning):169 env.from_string('{{ "jinja"|indent(indentfirst=true) }}').render()170
493 unmodified lines