Skip to content
Myr

add changelog and test

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 9933324 · Browse files · 2 files+31 added−1 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+31 added−1 removed

  • tests:+19 added−0 removed
  • other:+12 added−1 removed

2 files+31 added−1 removed

modified:tests/test_runtime.py+19 added
52 unmodified lines
53 )54 # groupby groups depend on the current position of the iterator. If55 # it was advanced early, the lists would appear empty.56 assert out == "1 [(1, 'a'), (1, 'b')]\n2 [(2, 'c')]\n3 [(3, 'd')]\n"575859def test_mock_not_contextfunction():60 """If a callable class has a ``__getattr__`` that returns True-like61 values for arbitrary attrs, it should not be incorrectly identified62 as a ``contextfunction``.63 """6465 class Calc(object):66 def __getattr__(self, item):67 return object()6869 def __call__(self, *args, **kwargs):70 return len(args) + len(kwargs)7172 t = Template("{{ calc() }}")73 out = t.render(calc=Calc())74 # Would be "1" if context argument was passed.75 assert out == "0"
modified:CHANGES.rst+12 added-1 removed
1.. currentmodule:: jinja2232.11.24------56Unreleased78- Fix a bug that caused callable objects with ``__getattr__``, like9 :class:`~unittest.mock.Mock` to be treated as a10 :func:`contextfunction`. :issue:`1145`11121314Version 2.11.115--------------166Unreleased17Released 2020-01-301819- Fix a bug that prevented looking up a key after an attribute20 (``{{ data.items[1:] }}``) in an async template. :issue:`1141`21
731 unmodified lines