mirror of
https://gitee.com/openharmony/third_party_jinja2
synced 2024-11-23 15:19:46 +00:00
add changelog and test
This commit is contained in:
parent
9933324688
commit
04294999c7
13
CHANGES.rst
13
CHANGES.rst
@ -1,9 +1,20 @@
|
||||
.. currentmodule:: jinja2
|
||||
|
||||
2.11.2
|
||||
------
|
||||
|
||||
Unreleased
|
||||
|
||||
- Fix a bug that caused callable objects with ``__getattr__``, like
|
||||
:class:`~unittest.mock.Mock` to be treated as a
|
||||
:func:`contextfunction`. :issue:`1145`
|
||||
|
||||
|
||||
|
||||
Version 2.11.1
|
||||
--------------
|
||||
|
||||
Unreleased
|
||||
Released 2020-01-30
|
||||
|
||||
- Fix a bug that prevented looking up a key after an attribute
|
||||
(``{{ data.items[1:] }}``) in an async template. :issue:`1141`
|
||||
|
@ -54,3 +54,22 @@ def test_iterator_not_advanced_early():
|
||||
# groupby groups depend on the current position of the iterator. If
|
||||
# it was advanced early, the lists would appear empty.
|
||||
assert out == "1 [(1, 'a'), (1, 'b')]\n2 [(2, 'c')]\n3 [(3, 'd')]\n"
|
||||
|
||||
|
||||
def test_mock_not_contextfunction():
|
||||
"""If a callable class has a ``__getattr__`` that returns True-like
|
||||
values for arbitrary attrs, it should not be incorrectly identified
|
||||
as a ``contextfunction``.
|
||||
"""
|
||||
|
||||
class Calc(object):
|
||||
def __getattr__(self, item):
|
||||
return object()
|
||||
|
||||
def __call__(self, *args, **kwargs):
|
||||
return len(args) + len(kwargs)
|
||||
|
||||
t = Template("{{ calc() }}")
|
||||
out = t.render(calc=Calc())
|
||||
# Would be "1" if context argument was passed.
|
||||
assert out == "0"
|
||||
|
Loading…
Reference in New Issue
Block a user