Skip to content
Myr

add tests and changelog

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

authored by David Lord · committed by David Lord · parent 5d79372 · Browse files · 2 files+22 added−2 removed
This commit

State

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

Diff stats

2 files+22 added−2 removed

  • tests:+20 added−2 removed
  • other:+2 added−0 removed

2 files+22 added−2 removed

modified:tests/test_imports.py+20 added-2 removed
9 unmodified lines
10"""11import pytest1213from jinja2 import Environment, DictLoader14from jinja2.exceptions import TemplateNotFound, TemplatesNotFound14from jinja2.exceptions import TemplateNotFound, TemplatesNotFound, \15 TemplateSyntaxError161718@pytest.fixture19def test_env():
30 unmodified lines
50 '{% from "module" import test with context %}{{ test() }}'51 )52 assert t.render(foo=42) == '[42|23]'5353 def test_trailing_comma(self, test_env):54 def test_import_needs_name(self, test_env):55 test_env.from_string('{% from "foo" import bar %}')56 test_env.from_string('{% from "foo" import bar, baz %}')5758 with pytest.raises(TemplateSyntaxError):59 test_env.from_string('{% from "foo" import %}')6061 def test_no_trailing_comma(self, test_env):62 with pytest.raises(TemplateSyntaxError):63 test_env.from_string('{% from "foo" import bar, %}')6465 with pytest.raises(TemplateSyntaxError):66 test_env.from_string('{% from "foo" import bar,, %}')6768 with pytest.raises(TemplateSyntaxError):69 test_env.from_string('{% from "foo" import, %}')7071 def test_trailing_comma_with_context(self, test_env):72 test_env.from_string('{% from "foo" import bar, baz with context %}')73 test_env.from_string('{% from "foo" import bar, baz, with context %}')74 test_env.from_string('{% from "foo" import bar, with context %}')75 test_env.from_string('{% from "foo" import bar, with, context %}')
99 unmodified lines
modified:CHANGES+2 added
26 unmodified lines
27- Add a ``unique`` filter. (`#469`_)28- Add ``min`` and ``max`` filters. (`#475`_)29- Add tests for all comparison operators: ``eq``, ``ne``, ``lt``, ``le``,30 ``gt``, ``ge``. (`#665`_)31- ``import`` statement cannot end with a trailing comma. (`#618`_)3233.. _#469: https://github.com/pallets/jinja/pull/46934.. _#475: https://github.com/pallets/jinja/pull/47535.. _#478: https://github.com/pallets/jinja/pull/47836.. _#618: https://github.com/pallets/jinja/pull/61837.. _#665: https://github.com/pallets/jinja/pull/6653839Version 2.9.640-------------
505 unmodified lines