============================= test session starts ==============================
platform linux -- Python 3.10.12, pytest-9.0.3, pluggy-1.6.0
rootdir: /workspace/jinja
configfile: pyproject.toml
plugins: anyio-4.13.0, metadata-3.1.1, json-report-1.5.0, cov-7.1.0
collected 851 items

tests/test_api.py F....F...FFF.FFFFFFFF..FFFFFF.FFF                      [  3%]
tests/test_async.py FFFEFFFFFF.FFFFFFFFFF...FFFFFFFF...FFFFFFFFFFFFF.FFF [  9%]
.FFFFF.                                                                  [ 10%]
tests/test_async_filters.py .FFFFFFFFF.FFF.F.F.F.F.F.F.F..FF.F.F...FFEFE [ 15%]
FE                                                                       [ 15%]
tests/test_bytecode_cache.py F..                                         [ 16%]
tests/test_compile.py FF                                                 [ 16%]
tests/test_core_tags.py ....FFFF...FFFFFFFFFFFFFF.F.FF..F.FFFFFFFFFFFFFF [ 21%]
FFFFF.FFFFFFFF                                                           [ 23%]
tests/test_debug.py FFFFFFF                                              [ 24%]
tests/test_ext.py FFFFFF.FFFFFFFFFFFF.FFFFFFFFFFFFFFFF.FFFFFFFFFFFFFF    [ 30%]
tests/test_filters.py ..........F...F........FFF.........F..........F... [ 36%]
.F....F.................F......FF.........FFFFFFFFFFFFFFFFFF...F........ [ 44%]
...FFFFFF                                                                [ 45%]
tests/test_idtracking.py FFFFF                                           [ 46%]
tests/test_imports.py FFFFFFFFFFFFFFF                                    [ 48%]
tests/test_inheritance.py FFFFFF.FFFFFFFFFFFFFFF                         [ 50%]
tests/test_lexnparse.py ..FFFFFFF.F......FFFF....F.FFFFF.FFF.......FF... [ 56%]
...................................F.FFF..FFF....FFFFFFFF...FF.FFFFFFFFF [ 64%]
FFFFFFFFFFFFFFFFF.FFFFFFFFFFFF                                           [ 68%]
tests/test_loader.py FF.FFFFFFFF.FFFFFFFFFFFFFFFF......FFFFFF.           [ 73%]
tests/test_nativetypes.py .F...........F.FF........F                     [ 76%]
tests/test_nodes.py .                                                    [ 76%]
tests/test_pickle.py .                                                   [ 76%]
tests/test_regression.py FF.F..FF.FFFFF.FFFFF..F.FFFFFFF.FF.FFF.FF.FFFFF [ 82%]
FF...                                                                    [ 82%]
tests/test_runtime.py FF...F.                                            [ 83%]
tests/test_security.py FFFFFFFFFFFFFFF                                   [ 85%]
tests/test_tests.py ....FFFFFFFFFFFFFFFF................................ [ 91%]
..............................FFFFFFFFFFFFFFFFFFFFFF..                   [ 97%]
tests/test_utils.py FF..FF..F.F..F...F..                                 [100%]

==================================== ERRORS ====================================
____________ ERROR at teardown of test_await_on_calls_normal_render ____________

coro = <coroutine object test_await_on_calls_normal_render.<locals>.async_func at 0x7f5c4cf3fbc0>

    def _warn_unawaited_coroutine(coro):
        msg_lines = [
            f"coroutine '{coro.__qualname__}' was never awaited\n"
        ]
        if coro.cr_origin is not None:
            import linecache, traceback
            def extract():
                for filename, lineno, funcname in reversed(coro.cr_origin):
                    line = linecache.getline(filename, lineno)
                    yield (filename, lineno, funcname, line)
            msg_lines.append("Coroutine created at (most recent call last)\n")
            msg_lines += traceback.format_list(list(extract()))
        msg = "".join(msg_lines).rstrip("\n")
        # Passing source= here means that if the user happens to have tracemalloc
        # enabled and tracking where the coroutine was created, the warning will
        # contain that traceback. This does mean that if they have *both*
        # coroutine origin tracking *and* tracemalloc enabled, they'll get two
        # partially-redundant tracebacks. If we wanted to be clever we could
        # probably detect this case and avoid it, but for now we don't bother.
>       warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
E       RuntimeWarning: coroutine 'test_await_on_calls_normal_render.<locals>.async_func' was never awaited

/usr/lib/python3.10/warnings.py:506: RuntimeWarning

The above exception was the direct cause of the following exception:

cls = <class '_pytest.runner.CallInfo'>
func = <function call_and_report.<locals>.<lambda> at 0x7f5c4ced3130>
when = 'teardown'
reraise = (<class '_pytest.outcomes.Exit'>, <class 'KeyboardInterrupt'>)

    @classmethod
    def from_call(
        cls,
        func: Callable[[], TResult],
        when: Literal["collect", "setup", "call", "teardown"],
        reraise: type[BaseException] | tuple[type[BaseException], ...] | None = None,
    ) -> CallInfo[TResult]:
        """Call func, wrapping the result in a CallInfo.
    
        :param func:
            The function to call. Called without arguments.
        :type func: Callable[[], _pytest.runner.TResult]
        :param when:
            The phase in which the function is called.
        :param reraise:
            Exception or exceptions that shall propagate if raised by the
            function, instead of being wrapped in the CallInfo.
        """
        excinfo = None
        instant = timing.Instant()
        try:
>           result: TResult | None = func()

/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py:353: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py:245: in <lambda>
    lambda: runtest_hook(item=item, **kwds),
/home/openhands/.local/lib/python3.10/site-packages/pluggy/_hooks.py:512: in __call__
    return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
/home/openhands/.local/lib/python3.10/site-packages/pluggy/_manager.py:120: in _hookexec
    return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
/home/openhands/.local/lib/python3.10/site-packages/_pytest/logging.py:858: in pytest_runtest_teardown
    yield
/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py:53: in run_old_style_hookwrapper
    return result.get_result()
/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py:38: in run_old_style_hookwrapper
    res = yield
/home/openhands/.local/lib/python3.10/site-packages/_pytest/capture.py:905: in pytest_runtest_teardown
    return (yield)
/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py:163: in pytest_runtest_teardown
    collect_unraisable(item.config)
/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py:79: in collect_unraisable
    raise errors[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

config = <_pytest.config.Config object at 0x7f5c4e18d4b0>

    def collect_unraisable(config: Config) -> None:
        pop_unraisable = config.stash[unraisable_exceptions].pop
        errors: list[pytest.PytestUnraisableExceptionWarning | RuntimeError] = []
        meta = None
        hook_error = None
        try:
            while True:
                try:
                    meta = pop_unraisable()
                except IndexError:
                    break
    
                if isinstance(meta, BaseException):
                    hook_error = RuntimeError("Failed to process unraisable exception")
                    hook_error.__cause__ = meta
                    errors.append(hook_error)
                    continue
    
                msg = meta.msg
                try:
>                   warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
E                   pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_await_on_calls_normal_render.<locals>.async_func at 0x7f5c4cf3fbc0>
E                   Enable tracemalloc to get traceback where the object was allocated.
E                   See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.

/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py:67: PytestUnraisableExceptionWarning
________________ ERROR at teardown of test_custom_async_filter _________________
  + Exception Group Traceback (most recent call last):
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py", line 353, in from_call
  |     result: TResult | None = func()
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py", line 245, in <lambda>
  |     lambda: runtest_hook(item=item, **kwds),
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 512, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
  |     raise exception
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/logging.py", line 858, in pytest_runtest_teardown
  |     yield
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
  |     return result.get_result()
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_result.py", line 103, in get_result
  |     raise exc.with_traceback(tb)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
  |     res = yield
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/capture.py", line 905, in pytest_runtest_teardown
  |     return (yield)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     res = hook_impl.function(*args)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 163, in pytest_runtest_teardown
  |     collect_unraisable(item.config)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 81, in collect_unraisable
  |     raise ExceptionGroup("multiple unraisable exception warnings", errors)
  | exceptiongroup.ExceptionGroup: multiple unraisable exception warnings (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/usr/lib/python3.10/warnings.py", line 506, in _warn_unawaited_coroutine
    |     warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
    | RuntimeWarning: coroutine 'test_custom_async_filter.<locals>.customfilter' was never awaited
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    | pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_custom_async_filter.<locals>.customfilter at 0x7f5c4cca2b90>
    | Enable tracemalloc to get traceback where the object was allocated.
    | See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/usr/lib/python3.10/warnings.py", line 506, in _warn_unawaited_coroutine
    |     warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
    | RuntimeWarning: coroutine 'test_custom_async_filter.<locals>.customfilter' was never awaited
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    | pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_custom_async_filter.<locals>.customfilter at 0x7f5c4cca3b50>
    | Enable tracemalloc to get traceback where the object was allocated.
    | See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    +------------------------------------
_____ ERROR at teardown of test_custom_async_iteratable_filter[<lambda>0] ______
  + Exception Group Traceback (most recent call last):
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py", line 353, in from_call
  |     result: TResult | None = func()
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py", line 245, in <lambda>
  |     lambda: runtest_hook(item=item, **kwds),
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 512, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
  |     raise exception
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/logging.py", line 858, in pytest_runtest_teardown
  |     yield
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
  |     return result.get_result()
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_result.py", line 103, in get_result
  |     raise exc.with_traceback(tb)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
  |     res = yield
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/capture.py", line 905, in pytest_runtest_teardown
  |     return (yield)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     res = hook_impl.function(*args)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 163, in pytest_runtest_teardown
  |     collect_unraisable(item.config)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 81, in collect_unraisable
  |     raise ExceptionGroup("multiple unraisable exception warnings", errors)
  | exceptiongroup.ExceptionGroup: multiple unraisable exception warnings (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/usr/lib/python3.10/warnings.py", line 506, in _warn_unawaited_coroutine
    |     warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
    | RuntimeWarning: coroutine 'test_custom_async_iteratable_filter.<locals>.customfilter' was never awaited
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    | pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca1fc0>
    | Enable tracemalloc to get traceback where the object was allocated.
    | See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/usr/lib/python3.10/warnings.py", line 506, in _warn_unawaited_coroutine
    |     warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
    | RuntimeWarning: coroutine 'test_custom_async_iteratable_filter.<locals>.customfilter' was never awaited
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    | pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca1540>
    | Enable tracemalloc to get traceback where the object was allocated.
    | See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    +------------------------------------
_____ ERROR at teardown of test_custom_async_iteratable_filter[<lambda>1] ______
  + Exception Group Traceback (most recent call last):
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py", line 353, in from_call
  |     result: TResult | None = func()
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/runner.py", line 245, in <lambda>
  |     lambda: runtest_hook(item=item, **kwds),
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_hooks.py", line 512, in __call__
  |     return self._hookexec(self.name, self._hookimpls.copy(), kwargs, firstresult)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_manager.py", line 120, in _hookexec
  |     return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 167, in _multicall
  |     raise exception
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/logging.py", line 858, in pytest_runtest_teardown
  |     yield
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 53, in run_old_style_hookwrapper
  |     return result.get_result()
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_result.py", line 103, in get_result
  |     raise exc.with_traceback(tb)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 38, in run_old_style_hookwrapper
  |     res = yield
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 139, in _multicall
  |     teardown.throw(exception)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/capture.py", line 905, in pytest_runtest_teardown
  |     return (yield)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/pluggy/_callers.py", line 121, in _multicall
  |     res = hook_impl.function(*args)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 163, in pytest_runtest_teardown
  |     collect_unraisable(item.config)
  |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 81, in collect_unraisable
  |     raise ExceptionGroup("multiple unraisable exception warnings", errors)
  | exceptiongroup.ExceptionGroup: multiple unraisable exception warnings (2 sub-exceptions)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/usr/lib/python3.10/warnings.py", line 506, in _warn_unawaited_coroutine
    |     warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
    | RuntimeWarning: coroutine 'test_custom_async_iteratable_filter.<locals>.customfilter' was never awaited
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    | pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca0890>
    | Enable tracemalloc to get traceback where the object was allocated.
    | See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    +---------------- 2 ----------------
    | Traceback (most recent call last):
    |   File "/usr/lib/python3.10/warnings.py", line 506, in _warn_unawaited_coroutine
    |     warn(msg, category=RuntimeWarning, stacklevel=2, source=coro)
    | RuntimeWarning: coroutine 'test_custom_async_iteratable_filter.<locals>.customfilter' was never awaited
    | 
    | The above exception was the direct cause of the following exception:
    | 
    | Traceback (most recent call last):
    |   File "/home/openhands/.local/lib/python3.10/site-packages/_pytest/unraisableexception.py", line 67, in collect_unraisable
    |     warnings.warn(pytest.PytestUnraisableExceptionWarning(msg))
    | pytest.PytestUnraisableExceptionWarning: Exception ignored in: <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca0970>
    | Enable tracemalloc to get traceback where the object was allocated.
    | See https://docs.pytest.org/en/stable/how-to/capture-warnings.html#resource-warnings for more info.
    +------------------------------------
=================================== FAILURES ===================================
___________________ TestExtendedAPI.test_item_and_attribute ____________________

self = <test_api.TestExtendedAPI object at 0x7f5c4d40ca00>
env = <jinja2.environment.Environment object at 0x7f5c4d32b160>

    def test_item_and_attribute(self, env):
        from jinja2.sandbox import SandboxedEnvironment
    
        for env in Environment(), SandboxedEnvironment():
            tmpl = env.from_string("{{ foo.items()|list }}")
            assert tmpl.render(foo={"items": 42}) == "[('items', 42)]"
            tmpl = env.from_string('{{ foo|attr("items")()|list }}')
>           assert tmpl.render(foo={"items": 42}) == "[('items', 42)]"

tests/test_api.py:35: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:911: in <listcomp>
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '"items")('
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': {'items': 42}, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4d32b160>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           "items")(
E                  ^
E       SyntaxError: unmatched ')'

src/jinja2/environment.py:915: SyntaxError
______________________ TestExtendedAPI.test_eval_finalize ______________________

self = <test_api.TestExtendedAPI object at 0x7f5c4d40d2a0>

    def test_eval_finalize(self):
        @pass_eval_context
        def finalize(eval_ctx, value):
            return str(eval_ctx.autoescape) + value
    
        e = Environment(finalize=finalize, autoescape=True)
        t = e.from_string("{{ value }}")
>       assert t.render(value="<script>") == "True&lt;script&gt;"

tests/test_api.py:71: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ce7cfa0>
value = 'True<script>'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
__________________ TestExtendedAPI.test_template_passthrough ___________________

self = <test_api.TestExtendedAPI object at 0x7f5c4d40dde0>
env = <jinja2.environment.Environment object at 0x7f5c4d045e70>

    def test_template_passthrough(self, env):
        t = Template("Content")
>       assert env.get_template(t) is t
E       assert None is <Template memory:7f5c4d046350>
E        +  where None = get_template(<Template memory:7f5c4d046350>)
E        +    where get_template = <jinja2.environment.Environment object at 0x7f5c4d045e70>.get_template

tests/test_api.py:107: AssertionError
_________________ TestExtendedAPI.test_get_template_undefined __________________

self = <test_api.TestExtendedAPI object at 0x7f5c4d40e0b0>
env = <jinja2.environment.Environment object at 0x7f5c4ce7d930>

    def test_get_template_undefined(self, env):
        """Passing Undefined to get/select_template raises an
        UndefinedError or shows the undefined message in the list.
        """
        env.loader = DictLoader({})
        t = Undefined(name="no_name_1")
    
>       with pytest.raises(UndefinedError):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.UndefinedError'>

tests/test_api.py:119: Failed
__________________ TestExtendedAPI.test_autoescape_autoselect __________________

self = <test_api.TestExtendedAPI object at 0x7f5c4d40e380>
env = <jinja2.environment.Environment object at 0x7f5c4d0448b0>

    def test_autoescape_autoselect(self, env):
        def select_autoescape(name):
            if name is None or "." not in name:
                return False
            return name.endswith(".html")
    
        env = Environment(
            autoescape=select_autoescape,
            loader=DictLoader({"test.txt": "{{ foo }}", "test.html": "{{ foo }}"}),
        )
        t = env.get_template("test.txt")
>       assert t.render(foo="<foo>") == "<foo>"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_api.py:146: AttributeError
___________________ TestMeta.test_find_undeclared_variables ____________________

self = <test_api.TestMeta object at 0x7f5c4d40e9b0>
env = <jinja2.environment.Environment object at 0x7f5c4ce7f070>

    def test_find_undeclared_variables(self, env):
        ast = env.parse("{% set foo = 42 %}{{ bar + foo }}")
>       x = meta.find_undeclared_variables(ast)

tests/test_api.py:166: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ast = None

    def find_undeclared_variables(ast:nodes.Template)->t.Set[str]:
        declared=set(); used=set()
>       for n in ast.find_all(nodes.Name):
E       AttributeError: 'NoneType' object has no attribute 'find_all'

src/jinja2/meta.py:14: AttributeError
__________________ TestMeta.test_find_refererenced_templates ___________________

self = <test_api.TestMeta object at 0x7f5c4d40ec80>
env = <jinja2.environment.Environment object at 0x7f5c4d03f640>

    def test_find_refererenced_templates(self, env):
        ast = env.parse('{% extends "layout.html" %}{% include helper %}')
        i = meta.find_referenced_templates(ast)
>       assert next(i) == "layout.html"

tests/test_api.py:185: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ast = None

    def find_referenced_templates(ast:nodes.Template)->t.Iterator[t.Optional[str]]:
>       for n in ast.find_all(_ref_types):
E       AttributeError: 'NoneType' object has no attribute 'find_all'

src/jinja2/meta.py:22: AttributeError
____________________ TestMeta.test_find_included_templates _____________________

self = <test_api.TestMeta object at 0x7f5c4d40ef50>
env = <jinja2.environment.Environment object at 0x7f5c4d04f2b0>

    def test_find_included_templates(self, env):
        ast = env.parse('{% include ["foo.html", "bar.html"] %}')
        i = meta.find_referenced_templates(ast)
>       assert list(i) == ["foo.html", "bar.html"]

tests/test_api.py:201: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

ast = None

    def find_referenced_templates(ast:nodes.Template)->t.Iterator[t.Optional[str]]:
>       for n in ast.find_all(_ref_types):
E       AttributeError: 'NoneType' object has no attribute 'find_all'

src/jinja2/meta.py:22: AttributeError
______________________ TestStreaming.test_basic_streaming ______________________

self = <test_api.TestStreaming object at 0x7f5c4d40e9e0>
env = <jinja2.environment.Environment object at 0x7f5c4d05a0e0>

    def test_basic_streaming(self, env):
        t = env.from_string(
            "<ul>{% for item in seq %}<li>{{ loop.index }} - {{ item }}</li>"
            "{%- endfor %}</ul>"
        )
        stream = t.stream(seq=list(range(3)))
>       assert next(stream) == "<ul>"
E       TypeError: 'NoneType' object is not an iterator

tests/test_api.py:223: TypeError
____________________ TestStreaming.test_buffered_streaming _____________________

self = <test_api.TestStreaming object at 0x7f5c4d40e980>
env = <jinja2.environment.Environment object at 0x7f5c4cff8130>

    def test_buffered_streaming(self, env):
        tmpl = env.from_string(
            "<ul>{% for item in seq %}<li>{{ loop.index }} - {{ item }}</li>"
            "{%- endfor %}</ul>"
        )
        stream = tmpl.stream(seq=list(range(3)))
>       stream.enable_buffering(size=3)
E       AttributeError: 'NoneType' object has no attribute 'enable_buffering'

tests/test_api.py:232: AttributeError
____________________ TestStreaming.test_streaming_behavior _____________________

self = <test_api.TestStreaming object at 0x7f5c4d40e0e0>
env = <jinja2.environment.Environment object at 0x7f5c4d0e30d0>

    def test_streaming_behavior(self, env):
        tmpl = env.from_string("")
        stream = tmpl.stream()
>       assert not stream.buffered
E       AttributeError: 'NoneType' object has no attribute 'buffered'

tests/test_api.py:239: AttributeError
________________________ TestStreaming.test_dump_stream ________________________

self = <test_api.TestStreaming object at 0x7f5c4d40dcf0>
env = <jinja2.environment.Environment object at 0x7f5c4ceac340>

    def test_dump_stream(self, env):
        tmp = Path(tempfile.mkdtemp())
        try:
            tmpl = env.from_string("\u2713")
            stream = tmpl.stream()
>           stream.dump(str(tmp / "dump.txt"), "utf-8")
E           AttributeError: 'NoneType' object has no attribute 'dump'

tests/test_api.py:250: AttributeError
________________ TestUndefined.test_stopiteration_is_undefined _________________

self = <test_api.TestUndefined object at 0x7f5c4d40d750>

    def test_stopiteration_is_undefined(self):
        def test():
            raise StopIteration()
    
        t = Template("A{{ test() }}B")
>       assert t.render(test=test) == "AB"

tests/test_api.py:262: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    def test():
>       raise StopIteration()
E       StopIteration

tests/test_api.py:259: StopIteration
_____________________ TestUndefined.test_logging_undefined _____________________

self = <test_api.TestUndefined object at 0x7f5c4d40cac0>

    def test_logging_undefined(self):
        _messages = []
    
        class DebugLogger:
            def warning(self, msg, *args):
                _messages.append("W:" + msg % args)
    
            def error(self, msg, *args):
                _messages.append("E:" + msg % args)
    
        logging_undefined = make_logging_undefined(DebugLogger())
        env = Environment(undefined=logging_undefined)
        assert env.from_string("{{ missing }}").render() == ""
        pytest.raises(UndefinedError, env.from_string("{{ missing.attribute }}").render)
        assert env.from_string("{{ missing|list }}").render() == "[]"
        assert env.from_string("{{ missing is not defined }}").render() == "True"
>       assert env.from_string("{{ foo.missing }}").render(foo=42) == ""

tests/test_api.py:301: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'int' object has no attribute 'missing'

<string>:1: AttributeError
_____________________ TestUndefined.test_default_undefined _____________________

self = <test_api.TestUndefined object at 0x7f5c4d40f220>

    def test_default_undefined(self):
        env = Environment(undefined=Undefined)
        assert env.from_string("{{ missing }}").render() == ""
        pytest.raises(UndefinedError, env.from_string("{{ missing.attribute }}").render)
        assert env.from_string("{{ missing|list }}").render() == "[]"
        assert env.from_string("{{ missing is not defined }}").render() == "True"
>       assert env.from_string("{{ foo.missing }}").render(foo=42) == ""

tests/test_api.py:317: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'int' object has no attribute 'missing'

<string>:1: AttributeError
____________________ TestUndefined.test_chainable_undefined ____________________

self = <test_api.TestUndefined object at 0x7f5c4d40f4f0>

    def test_chainable_undefined(self):
        env = Environment(undefined=ChainableUndefined)
        # The following tests are copied from test_default_undefined
        assert env.from_string("{{ missing }}").render() == ""
        assert env.from_string("{{ missing|list }}").render() == "[]"
        assert env.from_string("{{ missing is not defined }}").render() == "True"
>       assert env.from_string("{{ foo.missing }}").render(foo=42) == ""

tests/test_api.py:335: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'int' object has no attribute 'missing'

<string>:1: AttributeError
______________________ TestUndefined.test_debug_undefined ______________________

self = <test_api.TestUndefined object at 0x7f5c4d40f7c0>

    def test_debug_undefined(self):
        env = Environment(undefined=DebugUndefined)
        assert env.from_string("{{ missing }}").render() == "{{ missing }}"
        pytest.raises(UndefinedError, env.from_string("{{ missing.attribute }}").render)
        assert env.from_string("{{ missing|list }}").render() == "[]"
        assert env.from_string("{{ missing is not defined }}").render() == "True"
        assert (
>           env.from_string("{{ foo.missing }}").render(foo=42)
            == "{{ no such element: int object['missing'] }}"
        )

tests/test_api.py:362: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'int' object has no attribute 'missing'

<string>:1: AttributeError
_____________________ TestUndefined.test_strict_undefined ______________________

self = <test_api.TestUndefined object at 0x7f5c4d40fa90>

    def test_strict_undefined(self):
        env = Environment(undefined=StrictUndefined)
        pytest.raises(UndefinedError, env.from_string("{{ missing }}").render)
        pytest.raises(UndefinedError, env.from_string("{{ missing.attribute }}").render)
        pytest.raises(UndefinedError, env.from_string("{{ missing|list }}").render)
        pytest.raises(UndefinedError, env.from_string("{{ 'foo' in missing }}").render)
        assert env.from_string("{{ missing is not defined }}").render() == "True"
>       pytest.raises(
            UndefinedError, env.from_string("{{ foo.missing }}").render, foo=42
        )

tests/test_api.py:381: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'int' object has no attribute 'missing'

<string>:1: AttributeError
_________________ TestUndefined.test_indexing_gives_undefined __________________

self = <test_api.TestUndefined object at 0x7f5c4d40fd60>

    def test_indexing_gives_undefined(self):
        t = Template("{{ var[42].foo }}")
>       pytest.raises(UndefinedError, t.render, var=0)

tests/test_api.py:395: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: 'int' object is not subscriptable

<string>:1: TypeError
________________________ TestUndefined.test_object_repr ________________________

self = <test_api.TestUndefined object at 0x7f5c4d444340>

    def test_object_repr(self):
        with pytest.raises(
            UndefinedError, match="'int object' has no attribute 'upper'"
        ):
>           Undefined(obj=42, name="upper")()

tests/test_api.py:405: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'int' has no attribute 'upper'

src/jinja2/runtime.py:551: UndefinedError

During handling of the above exception, another exception occurred:

self = <test_api.TestUndefined object at 0x7f5c4d444340>

    def test_object_repr(self):
>       with pytest.raises(
            UndefinedError, match="'int object' has no attribute 'upper'"
        ):
E       AssertionError: Regex pattern did not match.
E         Expected regex: "'int object' has no attribute 'upper'"
E         Actual message: "'int' has no attribute 'upper'"

tests/test_api.py:402: AssertionError
___________________ TestLowLevel.test_custom_code_generator ____________________

self = <test_api.TestLowLevel object at 0x7f5c4d40fe80>

    def test_custom_code_generator(self):
        class CustomCodeGenerator(CodeGenerator):
            def visit_Const(self, node, frame=None):
                # This method is pure nonsense, but works fine for testing...
                if node.value == "foo":
                    self.write(repr("bar"))
                else:
                    super().visit_Const(node, frame)
    
        class CustomEnvironment(Environment):
            code_generator_class = CustomCodeGenerator
    
        env = CustomEnvironment()
        tmpl = env.from_string('{% set foo = "foo" %}{{ foo }}')
>       assert tmpl.render() == "bar"
E       AssertionError: assert 'foo' == 'bar'
E         
E         - bar
E         + foo

tests/test_api.py:423: AssertionError
_______________________ TestLowLevel.test_custom_context _______________________

self = <test_api.TestLowLevel object at 0x7f5c4d40f9d0>

    def test_custom_context(self):
        class CustomContext(Context):
            def resolve_or_missing(self, key):
                return "resolve-" + key
    
        class CustomEnvironment(Environment):
            context_class = CustomContext
    
        env = CustomEnvironment()
        tmpl = env.from_string("{{ foo }}")
>       assert tmpl.render() == "resolve-foo"
E       AssertionError: assert '' == 'resolve-foo'
E         
E         - resolve-foo

tests/test_api.py:435: AssertionError
_______________________________ test_basic_async _______________________________

    def test_basic_async():
        t = Template(
            "{% for item in [1, 2, 3] %}[{{ item }}]{% endfor %}", enable_async=True
        )
    
        async def func():
            return await t.render_async()
    
        rv = asyncio.run(func())
>       assert rv == "[1][2][3]"
E       AssertionError: assert None == '[1][2][3]'

tests/test_async.py:25: AssertionError
_____________________________ test_await_on_calls ______________________________

    def test_await_on_calls():
        t = Template("{{ async_func() + normal_func() }}", enable_async=True)
    
        async def async_func():
            return 42
    
        def normal_func():
            return 23
    
        async def func():
            return await t.render_async(async_func=async_func, normal_func=normal_func)
    
        rv = asyncio.run(func())
>       assert rv == "65"
E       AssertionError: assert None == '65'

tests/test_async.py:41: AssertionError
______________________ test_await_on_calls_normal_render _______________________

    def test_await_on_calls_normal_render():
        t = Template("{{ async_func() + normal_func() }}", enable_async=True)
    
        async def async_func():
            return 42
    
        def normal_func():
            return 23
    
>       rv = t.render(async_func=async_func, normal_func=normal_func)

tests/test_async.py:53: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for +: 'coroutine' and 'int'

<string>:1: TypeError
____________________________ test_await_and_macros _____________________________

    def test_await_and_macros():
        t = Template(
            "{% macro foo(x) %}[{{ x }}][{{ async_func() }}]{% endmacro %}{{ foo(42) }}",
            enable_async=True,
        )
    
        async def async_func():
            return 42
    
        async def func():
            return await t.render_async(async_func=async_func)
    
        rv = asyncio.run(func())
>       assert rv == "[42][42]"
E       AssertionError: assert None == '[42][42]'

tests/test_async.py:70: AssertionError
______________________________ test_async_blocks _______________________________

    def test_async_blocks():
        t = Template(
            "{% block foo %}<Test>{% endblock %}{{ self.foo() }}",
            enable_async=True,
            autoescape=True,
        )
    
        async def func():
            return await t.render_async()
    
        rv = asyncio.run(func())
>       assert rv == "<Test><Test>"
E       AssertionError: assert None == '<Test><Test>'

tests/test_async.py:84: AssertionError
_____________________________ test_async_generate ______________________________

    def test_async_generate():
        t = Template("{% for x in [1, 2, 3] %}{{ x }}{% endfor %}", enable_async=True)
>       rv = list(t.generate())
E       TypeError: 'NoneType' object is not iterable

tests/test_async.py:89: TypeError
______________________ test_async_iteration_in_templates _______________________

    def test_async_iteration_in_templates():
        t = Template("{% for x in rng %}{{ x }}{% endfor %}", enable_async=True)
    
        async def async_iterator():
            for item in [1, 2, 3]:
                yield item
    
>       rv = list(t.generate(rng=async_iterator()))
E       TypeError: 'NoneType' object is not iterable

tests/test_async.py:100: TypeError
__________________ test_async_iteration_in_templates_extended __________________

    def test_async_iteration_in_templates_extended():
        t = Template(
            "{% for x in rng %}{{ loop.index0 }}/{{ x }}{% endfor %}", enable_async=True
        )
        stream = t.generate(rng=auto_aiter(range(1, 4)))
>       assert next(stream) == "0"
E       TypeError: 'NoneType' object is not an iterator

tests/test_async.py:109: TypeError
____________________ TestAsyncImports.test_context_imports _____________________

self = <test_async.TestAsyncImports object at 0x7f5c4d445ae0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf59600>

    def test_context_imports(self, test_env_async):
        t = test_env_async.from_string('{% import "module" as m %}{{ m.test() }}')
>       assert t.render(foo=42) == "[|23]"

tests/test_async.py:132: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'm' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestAsyncImports.test_exports _________________________

self = <test_async.TestAsyncImports object at 0x7f5c4d446080>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cba0f70>

    def test_exports(self, test_env_async):
        coro = test_env_async.from_string(
            """
            {% macro toplevel() %}...{% endmacro %}
            {% macro __private() %}...{% endmacro %}
            {% set variable = 42 %}
            {% for item in [1] %}
                {% macro notthere() %}{% endmacro %}
            {% endfor %}
            """
>       )._get_default_module_async()
E       AttributeError: 'Template' object has no attribute '_get_default_module_async'. Did you mean: '_get_default_module'?

tests/test_async.py:169: AttributeError
__________________ TestAsyncImports.test_import_with_globals ___________________

self = <test_async.TestAsyncImports object at 0x7f5c4d4463b0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cce2920>

    def test_import_with_globals(self, test_env_async):
        t = test_env_async.from_string(
            '{% import "module" as m %}{{ m.test() }}', globals={"foo": 42}
        )
>       assert t.render() == "[42|23]"

tests/test_async.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'm' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________ TestAsyncImports.test_import_with_globals_override ______________

self = <test_async.TestAsyncImports object at 0x7f5c4d4466e0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cfd34c0>

    def test_import_with_globals_override(self, test_env_async):
        t = test_env_async.from_string(
            '{% set foo = 41 %}{% import "module" as m %}{{ m.test() }}',
            globals={"foo": 42},
        )
>       assert t.render() == "[42|23]"

tests/test_async.py:190: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'm' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________ TestAsyncImports.test_from_import_with_globals ________________

self = <test_async.TestAsyncImports object at 0x7f5c4d446a10>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf61030>

    def test_from_import_with_globals(self, test_env_async):
        t = test_env_async.from_string(
            '{% from "module" import test %}{{ test() }}',
            globals={"foo": 42},
        )
>       assert t.render() == "[42|23]"

tests/test_async.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'test' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestAsyncIncludes.test_context_include ____________________

self = <test_async.TestAsyncIncludes object at 0x7f5c4d446e30>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf70eb0>

    def test_context_include(self, test_env_async):
        t = test_env_async.from_string('{% include "header" %}')
>       assert t.render(foo=42) == "[42|23]"

tests/test_async.py:203: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf70eb0>
tokens = [('tag', 'include "header"')], pos = 0
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': 42, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
____________________ TestAsyncIncludes.test_choice_includes ____________________

self = <test_async.TestAsyncIncludes object at 0x7f5c4d447160>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf215d0>

    def test_choice_includes(self, test_env_async):
        t = test_env_async.from_string('{% include ["missing", "header"] %}')
>       assert t.render(foo=42) == "[42|23]"

tests/test_async.py:211: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf215d0>
tokens = [('tag', 'include ["missing", "header"]')], pos = 0
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': 42, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
_______________ TestAsyncIncludes.test_include_ignoring_missing ________________

self = <test_async.TestAsyncIncludes object at 0x7f5c4d447490>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d03d930>

    def test_include_ignoring_missing(self, test_env_async):
        t = test_env_async.from_string('{% include "missing" %}')
>       pytest.raises(TemplateNotFound, t.render)

tests/test_async.py:245: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d03d930>
tokens = [('tag', 'include "missing"')], pos = 0
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
____________ TestAsyncIncludes.test_context_include_with_overrides _____________

self = <test_async.TestAsyncIncludes object at 0x7f5c4d40fbb0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d059780>

    def test_context_include_with_overrides(self, test_env_async):
        env = Environment(
            loader=DictLoader(
                dict(
                    main="{% for item in [1, 2, 3] %}{% include 'item' %}{% endfor %}",
                    item="{{ item }}",
                )
            )
        )
>       assert env.get_template("main").render() == "123"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_async.py:261: AttributeError
__________________ TestAsyncIncludes.test_unoptimized_scopes ___________________

self = <test_async.TestAsyncIncludes object at 0x7f5c4d447280>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d046770>

    def test_unoptimized_scopes(self, test_env_async):
        t = test_env_async.from_string(
            """
            {% macro outer(o) %}
            {% macro inner() %}
            {% include "o_printer" %}
            {% endmacro %}
            {{ inner() }}
            {% endmacro %}
            {{ outer("FOO") }}
        """
        )
>       assert t.render().strip() == "(FOO)"

tests/test_async.py:275: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d046770>
tokens = [('text', '\n            '), ('tag', 'macro outer(o)'), ('text', '\n            '), ('tag', 'macro inner()'), ('text', '\n            '), ('tag', 'include "o_printer"'), ...]
pos = 5
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
_____________ TestAsyncIncludes.test_unoptimized_scopes_autoescape _____________

self = <test_async.TestAsyncIncludes object at 0x7f5c4d447130>

    def test_unoptimized_scopes_autoescape(self):
        env = Environment(
            loader=DictLoader({"o_printer": "({{ o }})"}),
            autoescape=True,
            enable_async=True,
        )
        t = env.from_string(
            """
            {% macro outer(o) %}
            {% macro inner() %}
            {% include "o_printer" %}
            {% endmacro %}
            {{ inner() }}
            {% endmacro %}
            {{ outer("FOO") }}
        """
        )
>       assert t.render().strip() == "(FOO)"

tests/test_async.py:294: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cdc0250>
tokens = [('text', '\n            '), ('tag', 'macro outer(o)'), ('text', '\n            '), ('tag', 'macro inner()'), ('text', '\n            '), ('tag', 'include "o_printer"'), ...]
pos = 5
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
________________ TestAsyncForLoop.test_context_vars[<lambda>0] _________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d444160>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d041390>
transform = <function TestAsyncForLoop.<lambda> at 0x7f5c4d45c940>

    @pytest.mark.parametrize(
        "transform", [lambda x: x, iter, reversed, lambda x: (i for i in x), auto_aiter]
    )
    def test_context_vars(self, test_env_async, transform):
        t = test_env_async.from_string(
            "{% for item in seq %}{{ loop.index }}|{{ loop.index0 }}"
            "|{{ loop.revindex }}|{{ loop.revindex0 }}|{{ loop.first }}"
            "|{{ loop.last }}|{{ loop.length }}\n{% endfor %}"
        )
>       out = t.render(seq=transform([42, 24]))

tests/test_async.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________ TestAsyncForLoop.test_context_vars[iter] ___________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d4448b0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4ceaea10>
transform = <built-in function iter>

    @pytest.mark.parametrize(
        "transform", [lambda x: x, iter, reversed, lambda x: (i for i in x), auto_aiter]
    )
    def test_context_vars(self, test_env_async, transform):
        t = test_env_async.from_string(
            "{% for item in seq %}{{ loop.index }}|{{ loop.index0 }}"
            "|{{ loop.revindex }}|{{ loop.revindex0 }}|{{ loop.first }}"
            "|{{ loop.last }}|{{ loop.length }}\n{% endfor %}"
        )
>       out = t.render(seq=transform([42, 24]))

tests/test_async.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________ TestAsyncForLoop.test_context_vars[reversed] _________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d444eb0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf223b0>
transform = <class 'reversed'>

    @pytest.mark.parametrize(
        "transform", [lambda x: x, iter, reversed, lambda x: (i for i in x), auto_aiter]
    )
    def test_context_vars(self, test_env_async, transform):
        t = test_env_async.from_string(
            "{% for item in seq %}{{ loop.index }}|{{ loop.index0 }}"
            "|{{ loop.revindex }}|{{ loop.revindex0 }}|{{ loop.first }}"
            "|{{ loop.last }}|{{ loop.length }}\n{% endfor %}"
        )
>       out = t.render(seq=transform([42, 24]))

tests/test_async.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________ TestAsyncForLoop.test_context_vars[<lambda>1] _________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d444b20>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d05fb20>
transform = <function TestAsyncForLoop.<lambda> at 0x7f5c4d45c9d0>

    @pytest.mark.parametrize(
        "transform", [lambda x: x, iter, reversed, lambda x: (i for i in x), auto_aiter]
    )
    def test_context_vars(self, test_env_async, transform):
        t = test_env_async.from_string(
            "{% for item in seq %}{{ loop.index }}|{{ loop.index0 }}"
            "|{{ loop.revindex }}|{{ loop.revindex0 }}|{{ loop.first }}"
            "|{{ loop.last }}|{{ loop.length }}\n{% endfor %}"
        )
>       out = t.render(seq=transform([42, 24]))

tests/test_async.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________ TestAsyncForLoop.test_context_vars[auto_aiter] ________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d445360>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d0409a0>
transform = <function auto_aiter at 0x7f5c4d50b010>

    @pytest.mark.parametrize(
        "transform", [lambda x: x, iter, reversed, lambda x: (i for i in x), auto_aiter]
    )
    def test_context_vars(self, test_env_async, transform):
        t = test_env_async.from_string(
            "{% for item in seq %}{{ loop.index }}|{{ loop.index0 }}"
            "|{{ loop.revindex }}|{{ loop.revindex0 }}|{{ loop.first }}"
            "|{{ loop.last }}|{{ loop.length }}\n{% endfor %}"
        )
>       out = t.render(seq=transform([42, 24]))

tests/test_async.py:323: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestAsyncForLoop.test_cycling _________________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d4452a0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf71420>

    def test_cycling(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for item in seq %}{{
            loop.cycle('<1>', '<2>') }}{% endfor %}{%
            for item in seq %}{{ loop.cycle(*through) }}{% endfor %}"""
        )
>       output = tmpl.render(seq=list(range(4)), through=("<1>", "<2>"))

tests/test_async.py:332: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestAsyncForLoop.test_lookaround _______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d447a30>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf55930>

    def test_lookaround(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for item in seq -%}
            {{ loop.previtem|default('x') }}-{{ item }}-{{
            loop.nextitem|default('x') }}|
        {%- endfor %}"""
        )
>       output = tmpl.render(seq=list(range(4)))

tests/test_async.py:342: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestAsyncForLoop.test_changed _________________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d447d00>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d0588e0>

    def test_changed(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for item in seq -%}
            {{ loop.changed(item) }},
        {%- endfor %}"""
        )
>       output = tmpl.render(seq=[None, None, 1, 2, 2, 3, 4, 4, 4])

tests/test_async.py:351: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestAsyncForLoop.test_recursive ________________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d447b50>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cef1a20>

    def test_recursive(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for item in seq recursive -%}
            [{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]
        {%- endfor %}"""
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[1<[1][2]>][2<[1][2]>][3<[a]>]"
        )

tests/test_async.py:380: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'item' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________ TestAsyncForLoop.test_recursive_lookaround __________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d447a00>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4ce4d030>

    def test_recursive_lookaround(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for item in seq recursive -%}
            [{{ loop.previtem.a if loop.previtem is defined else 'x' }}.{{
            item.a }}.{{ loop.nextitem.a if loop.nextitem is defined else 'x'
            }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]
        {%- endfor %}"""
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[x.1.2<[x.1.2][1.2.x]>][1.2.3<[x.1.2][1.2.x]>][2.3.x<[x.a.x]>]"
        )

tests/test_async.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:904: in _eval_expr
    if m: return _eval_expr(m.group(1),ctx,env) if _eval_expr(m.group(2),ctx,env) else _eval_expr(m.group(3),ctx,env)
src/jinja2/environment.py:907: in _eval_expr
    val=_eval_expr(m.group(1),ctx,env); args=[_eval_expr(a,ctx,env) for a in _split_top(m.group(4) or '', ',') if a]
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestAsyncForLoop.test_recursive_depth0 ____________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d4459f0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d03c1c0>

    def test_recursive_depth0(self, test_env_async):
        tmpl = test_env_async.from_string(
            "{% for item in seq recursive %}[{{ loop.depth0 }}:{{ item.a }}"
            "{% if item.b %}<{{ loop(item.b) }}>{% endif %}]{% endfor %}"
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[0:1<[1:1][1:2]>][0:2<[1:1][1:2]>][0:3<[1:a]>]"
        )

tests/test_async.py:415: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestAsyncForLoop.test_recursive_depth _____________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d446560>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf54a30>

    def test_recursive_depth(self, test_env_async):
        tmpl = test_env_async.from_string(
            "{% for item in seq recursive %}[{{ loop.depth }}:{{ item.a }}"
            "{% if item.b %}<{{ loop(item.b) }}>{% endif %}]{% endfor %}"
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[1:1<[2:1][2:2]>][1:2<[2:1][2:2]>][1:3<[2:a]>]"
        )

tests/test_async.py:431: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestAsyncForLoop.test_looploop ________________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d446d70>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cce1ed0>

    def test_looploop(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for row in table %}
            {%- set rowloop = loop -%}
            {% for cell in row -%}
                [{{ rowloop.index }}|{{ loop.index }}]
            {%- endfor %}
        {%- endfor %}"""
        )
>       assert tmpl.render(table=["ab", "cd"]) == "[1|1][1|2][2|1][2|2]"

tests/test_async.py:450: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestAsyncForLoop.test_reversed_bug ______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d4474c0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf56350>

    def test_reversed_bug(self, test_env_async):
        tmpl = test_env_async.from_string(
            "{% for i in items %}{{ i }}"
            "{% if not loop.last %}"
            ",{% endif %}{% endfor %}"
        )
>       assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3"

tests/test_async.py:458: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestAsyncForLoop.test_loop_errors _______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d284550>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cce0be0>

    def test_loop_errors(self, test_env_async):
        tmpl = test_env_async.from_string(
            """{% for item in [1] if loop.index
                                      == 0 %}...{% endfor %}"""
        )
>       pytest.raises(UndefinedError, tmpl.render)

tests/test_async.py:465: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '[1] if loop.index'
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cce0be0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           [1] if loop.index
E           ^^^^^^^^^^^^^^^^^
E       SyntaxError: expected 'else' after 'if' expression

src/jinja2/environment.py:915: SyntaxError
______________________ TestAsyncForLoop.test_loop_filter _______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d284310>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d05b730>

    def test_loop_filter(self, test_env_async):
        tmpl = test_env_async.from_string(
            "{% for item in range(10) if item is even %}[{{ item }}]{% endfor %}"
        )
>       assert tmpl.render() == "[0][2][4][6][8]"

tests/test_async.py:476: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:907: in _eval_expr
    val=_eval_expr(m.group(1),ctx,env); args=[_eval_expr(a,ctx,env) for a in _split_top(m.group(4) or '', ',') if a]
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'range(10) if item'
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4d05b730>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           range(10) if item
E           ^^^^^^^^^^^^^^^^^
E       SyntaxError: expected 'else' after 'if' expression

src/jinja2/environment.py:915: SyntaxError
___________________ TestAsyncForLoop.test_scoped_special_var ___________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d284a60>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d05da20>

    def test_scoped_special_var(self, test_env_async):
        t = test_env_async.from_string(
            "{% for s in seq %}[{{ loop.first }}{% for c in s %}"
            "|{{ loop.first }}{% endfor %}]{% endfor %}"
        )
>       assert t.render(seq=("ab", "cd")) == "[True|True|False][False|True|False]"

tests/test_async.py:489: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestAsyncForLoop.test_scoped_loop_var _____________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d284d90>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf237f0>

    def test_scoped_loop_var(self, test_env_async):
        t = test_env_async.from_string(
            "{% for x in seq %}{{ loop.first }}"
            "{% for y in seq %}{% endfor %}{% endfor %}"
        )
>       assert t.render(seq="ab") == "TrueFalse"

tests/test_async.py:496: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________ TestAsyncForLoop.test_recursive_empty_loop_iter ________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d2850c0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf72800>

    def test_recursive_empty_loop_iter(self, test_env_async):
        t = test_env_async.from_string(
            """
        {%- for item in foo recursive -%}{%- endfor -%}
        """
        )
>       assert t.render(dict(foo=[])) == ""

tests/test_async.py:509: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'foo recursive'
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': [], ...}
env = <jinja2.environment.Environment object at 0x7f5c4cf72800>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           foo recursive
E               ^^^^^^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
______________________ TestAsyncForLoop.test_call_in_loop ______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d2853f0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4cf62ec0>

    def test_call_in_loop(self, test_env_async):
        t = test_env_async.from_string(
            """
        {%- macro do_something() -%}
            [{{ caller() }}]
        {%- endmacro %}
    
        {%- for i in [1, 2, 3] %}
            {%- call do_something() -%}
                {{ i }}
            {%- endcall %}
        {%- endfor -%}
        """
        )
>       assert t.render() == "[1][2][3]"

tests/test_async.py:525: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'caller' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestAsyncForLoop.test_scoping_bug _______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d285720>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4ce73a30>

    def test_scoping_bug(self, test_env_async):
        t = test_env_async.from_string(
            """
        {%- for item in foo %}...{{ item }}...{% endfor %}
        {%- macro item(a) %}...{{ a }}...{% endmacro %}
        {{- item(2) -}}
        """
        )
>       assert t.render(foo=(1,)) == "...1......2..."
E       AssertionError: assert '\n        .....       ......' == '...1......2...'
E         
E         - ...1......2...
E         + 
E         +         ...1...
E         +         ......

tests/test_async.py:535: AssertionError
_________________ TestAsyncForLoop.test_recursive_loop_filter __________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d285d80>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d3e4f40>

    def test_recursive_loop_filter(self, test_env_async):
        t = test_env_async.from_string(
            """
        <?xml version="1.0" encoding="UTF-8"?>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
          {%- for page in [site.root] if page.url != this recursive %}
          <url><loc>{{ page.url }}</loc></url>
          {{- loop(page.children) }}
          {%- endfor %}
        </urlset>
        """
        )
>       sm = t.render(
            this="/foo",
            site={"root": {"url": "/", "children": [{"url": "/foo"}, {"url": "/bar"}]}},
        )

tests/test_async.py:555: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'page' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________ TestAsyncForLoop.test_nonrecursive_loop_filter ________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d2860b0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d445180>

    def test_nonrecursive_loop_filter(self, test_env_async):
        t = test_env_async.from_string(
            """
        <?xml version="1.0" encoding="UTF-8"?>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
          {%- for page in items if page.url != this %}
          <url><loc>{{ page.url }}</loc></url>
          {%- endfor %}
        </urlset>
        """
        )
>       sm = t.render(
            this="/foo", items=[{"url": "/"}, {"url": "/foo"}, {"url": "/bar"}]
        )

tests/test_async.py:579: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'page' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestAsyncForLoop.test_bare_async _______________________

self = <test_async.TestAsyncForLoop object at 0x7f5c4d4446a0>
test_env_async = <jinja2.environment.Environment object at 0x7f5c4d05f8b0>

    def test_bare_async(self, test_env_async):
        t = test_env_async.from_string('{% extends "header" %}')
>       assert t.render(foo=42) == "[42|23]"
E       AssertionError: assert '' == '[42|23]'
E         
E         - [42|23]

tests/test_async.py:593: AssertionError
___________________________ test_namespace_awaitable ___________________________

test_env_async = <jinja2.environment.Environment object at 0x7f5c4d040a00>

    def test_namespace_awaitable(test_env_async):
        async def _test():
            t = test_env_async.from_string(
                '{% set ns = namespace(foo="Bar") %}{{ ns.foo }}'
            )
            actual = await t.render_async()
            assert actual == "Bar"
    
>       asyncio.run(_test())

tests/test_async.py:608: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    async def _test():
        t = test_env_async.from_string(
            '{% set ns = namespace(foo="Bar") %}{{ ns.foo }}'
        )
        actual = await t.render_async()
>       assert actual == "Bar"
E       AssertionError: assert None == 'Bar'

tests/test_async.py:606: AssertionError
________________________ test_chainable_undefined_aiter ________________________

    def test_chainable_undefined_aiter():
        async def _test():
            t = Template(
                "{% for x in a['b']['c'] %}{{ x }}{% endfor %}",
                enable_async=True,
                undefined=ChainableUndefined,
            )
            rv = await t.render_async(a={})
            assert rv == ""
    
>       asyncio.run(_test())

tests/test_async.py:621: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    async def _test():
        t = Template(
            "{% for x in a['b']['c'] %}{{ x }}{% endfor %}",
            enable_async=True,
            undefined=ChainableUndefined,
        )
        rv = await t.render_async(a={})
>       assert rv == ""
E       AssertionError: assert None == ''

tests/test_async.py:619: AssertionError
______________________________ test_native_async _______________________________

async_native_env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4cbaee60>

    def test_native_async(async_native_env):
        async def _test():
            t = async_native_env.from_string("{{ x }}")
            rv = await t.render_async(x=23)
            assert rv == 23
    
>       asyncio.run(_test())

tests/test_async.py:635: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    async def _test():
        t = async_native_env.from_string("{{ x }}")
        rv = await t.render_async(x=23)
>       assert rv == 23
E       assert None == 23

tests/test_async.py:633: AssertionError
____________________________ test_native_list_async ____________________________

async_native_env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4cef14e0>

    def test_native_list_async(async_native_env):
        async def _test():
            t = async_native_env.from_string("{{ x }}")
            rv = await t.render_async(x=list(range(3)))
            assert rv == [0, 1, 2]
    
>       asyncio.run(_test())

tests/test_async.py:644: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python3.10/asyncio/runners.py:44: in run
    return loop.run_until_complete(main)
/usr/lib/python3.10/asyncio/base_events.py:649: in run_until_complete
    return future.result()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

    async def _test():
        t = async_native_env.from_string("{{ x }}")
        rv = await t.render_async(x=list(range(3)))
>       assert rv == [0, 1, 2]
E       assert None == [0, 1, 2]

tests/test_async.py:642: AssertionError
__________________________ test_getitem_after_filter ___________________________

    def test_getitem_after_filter():
        env = Environment(enable_async=True)
        env.filters["add_each"] = lambda v, x: [i + x for i in v]
        t = env.from_string("{{ (a|add_each(2))[1:] }}")
>       out = t.render(a=range(3))

tests/test_async.py:651: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (2,), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'add_each' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________________ test_first[<lambda>1] _____________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4ce7c190>
foo = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45e7a0>

    @mark_dualiter("foo", lambda: range(10))
    def test_first(env_async, foo):
        tmpl = env_async.from_string("{{ foo()|first }}")
>       out = tmpl.render(foo=foo)

tests/test_async_filters.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

environment = <jinja2.environment.Environment object at 0x7f5c4ce7c190>
seq = <async_generator object make_aiter at 0x7f5c4cd7d740>

    @pass_environment
    def sync_do_first(environment, seq):
>       try: return next(iter(seq))
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:984: TypeError
___________________________ test_groupby[<lambda>0] ____________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cf56b30>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45e950>

    @mark_dualiter(
        "items",
        lambda: [
            {"foo": 1, "bar": 2},
            {"foo": 2, "bar": 3},
            {"foo": 1, "bar": 1},
            {"foo": 3, "bar": 4},
        ],
    )
    def test_groupby(env_async, items):
        tmpl = env_async.from_string(
            """
        {%- for grouper, list in items()|groupby('foo') -%}
            {{ grouper }}{% for x in list %}: {{ x.foo }}, {{ x.bar }}{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(items=items).split("|") == [
            "1: 1, 2: 1, 1",
            "2: 2, 3",
            "3: 3, 4",
            "",
        ]

tests/test_async_filters.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________________ test_groupby[<lambda>1] ____________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d05b820>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45e9e0>

    @mark_dualiter(
        "items",
        lambda: [
            {"foo": 1, "bar": 2},
            {"foo": 2, "bar": 3},
            {"foo": 1, "bar": 1},
            {"foo": 3, "bar": 4},
        ],
    )
    def test_groupby(env_async, items):
        tmpl = env_async.from_string(
            """
        {%- for grouper, list in items()|groupby('foo') -%}
            {{ grouper }}{% for x in list %}: {{ x.foo }}, {{ x.bar }}{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(items=items).split("|") == [
            "1: 1, 2: 1, 1",
            "2: 2, 3",
            "3: 3, 4",
            "",
        ]

tests/test_async_filters.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________ test_groupby_case[False-a: 1, 3\nb: 2\n] ___________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cf20b20>
case_sensitive = False, expect = 'a: 1, 3\nb: 2\n'

    @pytest.mark.parametrize(
        ("case_sensitive", "expect"),
        [
            (False, "a: 1, 3\nb: 2\n"),
            (True, "A: 3\na: 1\nb: 2\n"),
        ],
    )
    def test_groupby_case(env_async, case_sensitive, expect):
        tmpl = env_async.from_string(
            "{% for k, vs in data|groupby('k', case_sensitive=cs) %}"
            "{{ k }}: {{ vs|join(', ', attribute='v') }}\n"
            "{% endfor %}"
        )
        out = tmpl.render(
            data=[{"k": "a", "v": 1}, {"k": "b", "v": 2}, {"k": "A", "v": 3}],
            cs=case_sensitive,
        )
>       assert out == expect
E       AssertionError: assert 'a: 1, 3\nb: 2' == 'a: 1, 3\nb: 2\n'
E         
E           a: 1, 3
E         - b: 2
E         ?     -
E         + b: 2

tests/test_async_filters.py:77: AssertionError
__________________ test_groupby_case[True-A: 3\na: 1\nb: 2\n] __________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cdc2fb0>
case_sensitive = True, expect = 'A: 3\na: 1\nb: 2\n'

    @pytest.mark.parametrize(
        ("case_sensitive", "expect"),
        [
            (False, "a: 1, 3\nb: 2\n"),
            (True, "A: 3\na: 1\nb: 2\n"),
        ],
    )
    def test_groupby_case(env_async, case_sensitive, expect):
        tmpl = env_async.from_string(
            "{% for k, vs in data|groupby('k', case_sensitive=cs) %}"
            "{{ k }}: {{ vs|join(', ', attribute='v') }}\n"
            "{% endfor %}"
        )
        out = tmpl.render(
            data=[{"k": "a", "v": 1}, {"k": "b", "v": 2}, {"k": "A", "v": 3}],
            cs=case_sensitive,
        )
>       assert out == expect
E       AssertionError: assert 'A: 3\na: 1\nb: 2' == 'A: 3\na: 1\nb: 2\n'
E         
E           A: 3
E           a: 1
E         - b: 2
E         ?     -
E         + b: 2

tests/test_async_filters.py:77: AssertionError
_____________________ test_groupby_tuple_index[<lambda>0] ______________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cf223e0>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45ec20>

    @mark_dualiter("items", lambda: [("a", 1), ("a", 2), ("b", 1)])
    def test_groupby_tuple_index(env_async, items):
        tmpl = env_async.from_string(
            """
        {%- for grouper, list in items()|groupby(0) -%}
            {{ grouper }}{% for x in list %}:{{ x.1 }}{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(items=items) == "a:1:2|b:1|"

tests/test_async_filters.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'x.1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45ec20>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cf223e0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           x.1
E            ^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_____________________ test_groupby_tuple_index[<lambda>1] ______________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d058490>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45ecb0>

    @mark_dualiter("items", lambda: [("a", 1), ("a", 2), ("b", 1)])
    def test_groupby_tuple_index(env_async, items):
        tmpl = env_async.from_string(
            """
        {%- for grouper, list in items()|groupby(0) -%}
            {{ grouper }}{% for x in list %}:{{ x.1 }}{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(items=items) == "a:1:2|b:1|"

tests/test_async_filters.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'x.1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45ecb0>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4d058490>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           x.1
E            ^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_______________________ test_groupby_multidot[<lambda>0] _______________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d05de40>
articles = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45ee60>

    @mark_dualiter("articles", make_articles)
    def test_groupby_multidot(env_async, articles):
        tmpl = env_async.from_string(
            """
        {%- for year, list in articles()|groupby('date.year') -%}
            {{ year }}{% for x in list %}[{{ x.title }}]{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(articles=articles).split("|") == [
            "1970[aha][interesting][really?]",
            "1971[totally not]",
            "",
        ]

tests/test_async_filters.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ test_groupby_multidot[<lambda>1] _______________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cdc3430>
articles = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45eef0>

    @mark_dualiter("articles", make_articles)
    def test_groupby_multidot(env_async, articles):
        tmpl = env_async.from_string(
            """
        {%- for year, list in articles()|groupby('date.year') -%}
            {{ year }}{% for x in list %}[{{ x.title }}]{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(articles=articles).split("|") == [
            "1970[aha][interesting][really?]",
            "1971[totally not]",
            "",
        ]

tests/test_async_filters.py:110: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ test_join_env_int[<lambda>1] _________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4ceac5b0>
int_items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45f130>

    @mark_dualiter("int_items", lambda: [1, 2, 3])
    def test_join_env_int(env_async, int_items):
        tmpl = env_async.from_string('{{ items()|join("|") }}')
>       out = tmpl.render(items=int_items)

tests/test_async_filters.py:120: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

eval_ctx = <jinja2.nodes.EvalContext object at 0x7f5c4cead210>
value = <async_generator object make_aiter at 0x7f5c4cd1bbc0>, d = '|'
attribute = None

    @pass_eval_context
    def sync_do_join(eval_ctx, value, d='', attribute=None):
        if attribute is not None: value=map(make_attrgetter(eval_ctx.environment, attribute), value)
>       return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:979: TypeError
_______________________ test_join_string_list[<lambda>0] _______________________

string_items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45f2e0>

    @mark_dualiter("string_items", lambda: ["<foo>", Markup("<span>foo</span>")])
    def test_join_string_list(string_items):
        env2 = Environment(autoescape=True, enable_async=True)
        tmpl = env2.from_string('{{ ["<foo>", "<span>foo</span>"|safe]|join }}')
>       assert tmpl.render(items=string_items) == "&lt;foo&gt;<span>foo</span>"

tests/test_async_filters.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
_______________________ test_join_string_list[<lambda>1] _______________________

string_items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45f370>

    @mark_dualiter("string_items", lambda: ["<foo>", Markup("<span>foo</span>")])
    def test_join_string_list(string_items):
        env2 = Environment(autoescape=True, enable_async=True)
        tmpl = env2.from_string('{{ ["<foo>", "<span>foo</span>"|safe]|join }}')
>       assert tmpl.render(items=string_items) == "&lt;foo&gt;<span>foo</span>"

tests/test_async_filters.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
________________________ test_join_attribute[<lambda>1] ________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cf72440>
users = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45f5b0>

    @mark_dualiter("users", make_users)
    def test_join_attribute(env_async, users):
        tmpl = env_async.from_string("""{{ users()|join(', ', 'username') }}""")
>       assert tmpl.render(users=users) == "foo, bar"

tests/test_async_filters.py:139: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

eval_ctx = <jinja2.nodes.EvalContext object at 0x7f5c4cf70190>
value = <async_generator object make_aiter at 0x7f5c4ccfe2c0>, d = ', '
attribute = 'username'

    @pass_eval_context
    def sync_do_join(eval_ctx, value, d='', attribute=None):
>       if attribute is not None: value=map(make_attrgetter(eval_ctx.environment, attribute), value)
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:978: TypeError
________________________ test_simple_reject[<lambda>1] _________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cce3f70>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45f7f0>

    @mark_dualiter("items", lambda: [1, 2, 3, 4, 5])
    def test_simple_reject(env_async, items):
        tmpl = env_async.from_string('{{ items()|reject("odd")|join("|") }}')
>       assert tmpl.render(items=items) == "2|4"

tests/test_async_filters.py:145: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:979: in sync_do_join
    return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45f7f0>} of None>
value = <async_generator object make_aiter at 0x7f5c4ccfd840>, args = ('odd',)
kwargs = {}, mod = <function sync_do_reject.<locals>.<lambda> at 0x7f5c4ce170a0>
attr = False

    def _sel(context,value,args,kwargs,mod,attr=False):
        trans=make_attrgetter(context.environment,args[0]) if attr else (lambda x:x); args=args[1:] if attr else args
        func=(lambda x: context.environment.call_test(args[0],x,args[1:],kwargs,context=context)) if args else bool
>       for item in value:
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1090: TypeError
_________________________ test_bool_reject[<lambda>1] __________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d045e70>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45fa30>

    @mark_dualiter("items", lambda: [None, False, 0, 1, 2, 3, 4, 5])
    def test_bool_reject(env_async, items):
        tmpl = env_async.from_string('{{ items()|reject|join("|") }}')
>       assert tmpl.render(items=items) == "None|False|0"

tests/test_async_filters.py:151: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:979: in sync_do_join
    return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45fa30>} of None>
value = <async_generator object make_aiter at 0x7f5c4ccfcd40>, args = ()
kwargs = {}, mod = <function sync_do_reject.<locals>.<lambda> at 0x7f5c4ccad360>
attr = False

    def _sel(context,value,args,kwargs,mod,attr=False):
        trans=make_attrgetter(context.environment,args[0]) if attr else (lambda x:x); args=args[1:] if attr else args
        func=(lambda x: context.environment.call_test(args[0],x,args[1:],kwargs,context=context)) if args else bool
>       for item in value:
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1090: TypeError
________________________ test_simple_select[<lambda>1] _________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4ce4efe0>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45fc70>

    @mark_dualiter("items", lambda: [1, 2, 3, 4, 5])
    def test_simple_select(env_async, items):
        tmpl = env_async.from_string('{{ items()|select("odd")|join("|") }}')
>       assert tmpl.render(items=items) == "1|3|5"

tests/test_async_filters.py:157: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:979: in sync_do_join
    return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45fc70>} of None>
value = <async_generator object make_aiter at 0x7f5c4ccfc2c0>, args = ('odd',)
kwargs = {}, mod = <function sync_do_select.<locals>.<lambda> at 0x7f5c4ccad7e0>
attr = False

    def _sel(context,value,args,kwargs,mod,attr=False):
        trans=make_attrgetter(context.environment,args[0]) if attr else (lambda x:x); args=args[1:] if attr else args
        func=(lambda x: context.environment.call_test(args[0],x,args[1:],kwargs,context=context)) if args else bool
>       for item in value:
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1090: TypeError
_________________________ test_bool_select[<lambda>1] __________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cff8700>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45feb0>

    @mark_dualiter("items", lambda: [None, False, 0, 1, 2, 3, 4, 5])
    def test_bool_select(env_async, items):
        tmpl = env_async.from_string('{{ items()|select|join("|") }}')
>       assert tmpl.render(items=items) == "1|2|3|4|5"

tests/test_async_filters.py:163: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:979: in sync_do_join
    return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d45feb0>} of None>
value = <async_generator object make_aiter at 0x7f5c4cd1bc40>, args = ()
kwargs = {}, mod = <function sync_do_select.<locals>.<lambda> at 0x7f5c4ce160e0>
attr = False

    def _sel(context,value,args,kwargs,mod,attr=False):
        trans=make_attrgetter(context.environment,args[0]) if attr else (lambda x:x); args=args[1:] if attr else args
        func=(lambda x: context.environment.call_test(args[0],x,args[1:],kwargs,context=context)) if args else bool
>       for item in value:
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1090: TypeError
______________________ test_simple_select_attr[<lambda>1] ______________________

env_async = <jinja2.environment.Environment object at 0x7f5c4ce7d9f0>
users = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a0160>

    @mark_dualiter("users", make_users)
    def test_simple_select_attr(env_async, users):
        tmpl = env_async.from_string(
            '{{ users()|selectattr("is_active")|map(attribute="name")|join("|") }}'
        )
>       assert tmpl.render(users=users) == "john|jane"

tests/test_async_filters.py:180: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:979: in sync_do_join
    return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
src/jinja2/filters.py:1085: in sync_do_map
    for item in value: yield func(item)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'users': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a0160>} of None>
value = <async_generator object make_aiter at 0x7f5c4cd1a5c0>, args = ()
kwargs = {}
mod = <function sync_do_selectattr.<locals>.<lambda> at 0x7f5c4ccac160>
attr = True

    def _sel(context,value,args,kwargs,mod,attr=False):
        trans=make_attrgetter(context.environment,args[0]) if attr else (lambda x:x); args=args[1:] if attr else args
        func=(lambda x: context.environment.call_test(args[0],x,args[1:],kwargs,context=context)) if args else bool
>       for item in value:
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1090: TypeError
__________________________ test_simple_map[<lambda>1] __________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4ce241f0>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a03a0>

    @mark_dualiter("items", lambda: list("123"))
    def test_simple_map(env_async, items):
        tmpl = env_async.from_string('{{ items()|map("int")|sum }}')
>       assert tmpl.render(items=items) == "6"

tests/test_async_filters.py:186: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:1065: in sync_do_sum
    return sum(iterable,start)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'items': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a03a0>} of None>
value = <async_generator object make_aiter at 0x7f5c4ccfc5c0>, args = ('int',)
kwargs = {}, func = <function sync_do_map.<locals>.<lambda> at 0x7f5c4ccad2d0>

    @pass_context
    def sync_do_map(context,value,*args,**kwargs):
        if not args and 'attribute' in kwargs:
            func=make_attrgetter(context.environment, kwargs.pop('attribute'), default=kwargs.pop('default', None))
        else:
            name=args[0]; fargs=args[1:]; func=lambda x: context.environment.call_filter(name,x,fargs,kwargs,context=context)
>       for item in value: yield func(item)
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1085: TypeError
________________________ test_attribute_map[<lambda>1] _________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d04c5b0>
users = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a05e0>

    @mark_dualiter("users", make_users)
    def test_attribute_map(env_async, users):
        tmpl = env_async.from_string('{{ users()|map(attribute="name")|join("|") }}')
>       assert tmpl.render(users=users) == "john|jane|mike"

tests/test_async_filters.py:197: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:979: in sync_do_join
    return soft_str(d).join(map(soft_str, value)) if not eval_ctx.autoescape else escape(d).join(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...2.utils.Namespace'>, 'users': <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a05e0>} of None>
value = <async_generator object make_aiter at 0x7f5c4ccfdbc0>, args = ()
kwargs = {}, func = <function make_attrgetter.<locals>.g at 0x7f5c4ccac700>

    @pass_context
    def sync_do_map(context,value,*args,**kwargs):
        if not args and 'attribute' in kwargs:
            func=make_attrgetter(context.environment, kwargs.pop('attribute'), default=kwargs.pop('default', None))
        else:
            name=args[0]; fargs=args[1:]; func=lambda x: context.environment.call_filter(name,x,fargs,kwargs,context=context)
>       for item in value: yield func(item)
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1085: TypeError
________________________________ test_empty_map ________________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cf56bc0>

    def test_empty_map(env_async):
        tmpl = env_async.from_string('{{ none|map("upper")|list }}')
>       assert tmpl.render() == "[]"

tests/test_async_filters.py:202: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:1067: in sync_do_list
    def sync_do_list(value): return list(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...jinja2.utils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>} of None>
value = None, args = ('upper',), kwargs = {}
func = <function sync_do_map.<locals>.<lambda> at 0x7f5c4ccadf30>

    @pass_context
    def sync_do_map(context,value,*args,**kwargs):
        if not args and 'attribute' in kwargs:
            func=make_attrgetter(context.environment, kwargs.pop('attribute'), default=kwargs.pop('default', None))
        else:
            name=args[0]; fargs=args[1:]; func=lambda x: context.environment.call_filter(name,x,fargs,kwargs,context=context)
>       for item in value: yield func(item)
E       TypeError: 'NoneType' object is not iterable

src/jinja2/filters.py:1085: TypeError
_____________________________ test_sum[<lambda>1] ______________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d2aca60>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a08b0>

    @mark_dualiter("items", lambda: [1, 2, 3, 4, 5, 6])
    def test_sum(env_async, items):
        tmpl = env_async.from_string("""{{ items()|sum }}""")
>       assert tmpl.render(items=items) == "21"

tests/test_async_filters.py:208: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

environment = <jinja2.environment.Environment object at 0x7f5c4d2aca60>
iterable = <async_generator object make_aiter at 0x7f5c4ccfdf40>
attribute = None, start = 0

    @pass_environment
    def sync_do_sum(environment,iterable,attribute=None,start=0):
        if attribute is not None: iterable=map(make_attrgetter(environment,attribute),iterable)
>       return sum(iterable,start)
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1065: TypeError
________________________ test_sum_attributes[<lambda>1] ________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cff92a0>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a0af0>

    @mark_dualiter("items", lambda: [{"value": 23}, {"value": 1}, {"value": 18}])
    def test_sum_attributes(env_async, items):
        tmpl = env_async.from_string("""{{ items()|sum('value') }}""")
>       assert tmpl.render(items=items)

tests/test_async_filters.py:214: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

environment = <jinja2.environment.Environment object at 0x7f5c4cff92a0>
iterable = <async_generator object make_aiter at 0x7f5c4ccfd040>
attribute = 'value', start = 0

    @pass_environment
    def sync_do_sum(environment,iterable,attribute=None,start=0):
>       if attribute is not None: iterable=map(make_attrgetter(environment,attribute),iterable)
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1064: TypeError
____________________________ test_slice[<lambda>1] _____________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cdc1660>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a0e50>

    @mark_dualiter("items", lambda: range(10))
    def test_slice(env_async, items):
        tmpl = env_async.from_string(
            "{{ items()|slice(3)|list }}|{{ items()|slice(3, 'X')|list }}"
        )
>       out = tmpl.render(items=items)

tests/test_async_filters.py:241: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:1067: in sync_do_list
    def sync_do_list(value): return list(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

value = <async_generator object make_aiter at 0x7f5c4ccfd240>, slices = 3
fill_with = None

    def sync_do_slice(value,slices,fill_with=None):
>       seq=list(value); n=len(seq); per=n//slices; extra=n%slices; off=0
E       TypeError: 'async_generator' object is not iterable

src/jinja2/filters.py:1036: TypeError
___________________________ test_custom_async_filter ___________________________

env_async = <jinja2.environment.Environment object at 0x7f5c4d041ae0>

    def test_custom_async_filter(env_async):
        async def customfilter(val):
            return str(val)
    
        env_async.filters["customfilter"] = customfilter
        tmpl = env_async.from_string("{{ 'static'|customfilter }} {{ arg|customfilter }}")
        out = tmpl.render(arg="dynamic")
>       assert out == "static dynamic"
E       AssertionError: assert '<coroutine o...7f5c4cca2b90>' == 'static dynamic'
E         
E         - static dynamic
E         + <coroutine object test_custom_async_filter.<locals>.customfilter at 0x7f5c4cca3b50> <coroutine object test_custom_async_filter.<locals>.customfilter at 0x7f5c4cca2b90>

tests/test_async_filters.py:255: AssertionError
________________ test_custom_async_iteratable_filter[<lambda>0] ________________

env_async = <jinja2.environment.Environment object at 0x7f5c4ce73a90>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a1090>

    @mark_dualiter("items", lambda: range(10))
    def test_custom_async_iteratable_filter(env_async, items):
        async def customfilter(iterable):
            items = []
            async for item in auto_aiter(iterable):
                items.append(str(item))
                if len(items) == 3:
                    break
            return ",".join(items)
    
        env_async.filters["customfilter"] = customfilter
        tmpl = env_async.from_string(
            "{{ items()|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}"
        )
        out = tmpl.render(items=items)
>       assert out == "0,1,2 .. 3,4,5"
E       AssertionError: assert '<coroutine o...7f5c4cca1fc0>' == '0,1,2 .. 3,4,5'
E         
E         - 0,1,2 .. 3,4,5
E         + <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca1540> .. <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca1fc0>

tests/test_async_filters.py:273: AssertionError
________________ test_custom_async_iteratable_filter[<lambda>1] ________________

env_async = <jinja2.environment.Environment object at 0x7f5c4cbd7d90>
items = <function mark_dualiter.<locals>.decorator.<locals>.<lambda> at 0x7f5c4d2a1120>

    @mark_dualiter("items", lambda: range(10))
    def test_custom_async_iteratable_filter(env_async, items):
        async def customfilter(iterable):
            items = []
            async for item in auto_aiter(iterable):
                items.append(str(item))
                if len(items) == 3:
                    break
            return ",".join(items)
    
        env_async.filters["customfilter"] = customfilter
        tmpl = env_async.from_string(
            "{{ items()|customfilter }} .. {{ [3, 4, 5, 6]|customfilter }}"
        )
        out = tmpl.render(items=items)
>       assert out == "0,1,2 .. 3,4,5"
E       AssertionError: assert '<coroutine o...7f5c4cca0890>' == '0,1,2 .. 3,4,5'
E         
E         - 0,1,2 .. 3,4,5
E         + <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca0970> .. <coroutine object test_custom_async_iteratable_filter.<locals>.customfilter at 0x7f5c4cca0890>

tests/test_async_filters.py:273: AssertionError
________________________ TestByteCodeCache.test_simple _________________________

self = <test_bytecode_cache.TestByteCodeCache object at 0x7f5c4d2ae560>
env = <jinja2.environment.Environment object at 0x7f5c4d03f6a0>

    def test_simple(self, env):
        tmpl = env.get_template("test.html")
>       assert tmpl.render().strip() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_bytecode_cache.py:19: AttributeError
__________________________ test_filters_deterministic __________________________

tmp_path = PosixPath('/tmp/pytest-of-openhands/pytest-2/test_filters_deterministic0')

    def test_filters_deterministic(tmp_path):
        src = "".join(f"{{{{ {i}|filter{i} }}}}" for i in range(10))
        env = Environment(loader=DictLoader({"foo": src}))
        env.filters.update(dict.fromkeys((f"filter{i}" for i in range(10)), lambda: None))
        env.compile_templates(tmp_path, zip=None)
>       name = os.listdir(tmp_path)[0]
E       IndexError: list index out of range

tests/test_compile.py:13: IndexError
__________________ test_import_as_with_context_deterministic ___________________

tmp_path = PosixPath('/tmp/pytest-of-openhands/pytest-2/test_import_as_with_context_de0')

    def test_import_as_with_context_deterministic(tmp_path):
        src = "\n".join(f'{{% import "bar" as bar{i} with context %}}' for i in range(10))
        env = Environment(loader=DictLoader({"foo": src}))
        env.compile_templates(tmp_path, zip=None)
>       name = os.listdir(tmp_path)[0]
E       IndexError: list index out of range

tests/test_compile.py:24: IndexError
________________________ TestForLoop.test_context_vars _________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d5240>
env = <jinja2.environment.Environment object at 0x7f5c4ce714e0>

    def test_context_vars(self, env):
        slist = [42, 24]
        for seq in [slist, iter(slist), reversed(slist), (_ for _ in slist)]:
            tmpl = env.from_string(
                """{% for item in seq -%}
            {{ loop.index }}|{{ loop.index0 }}|{{ loop.revindex }}|{{
                loop.revindex0 }}|{{ loop.first }}|{{ loop.last }}|{{
               loop.length }}###{% endfor %}"""
            )
>           one, two, _ = tmpl.render(seq=seq).split("###")

tests/test_core_tags.py:41: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________________ TestForLoop.test_cycling ___________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d5570>
env = <jinja2.environment.Environment object at 0x7f5c4cbafe50>

    def test_cycling(self, env):
        tmpl = env.from_string(
            """{% for item in seq %}{{
            loop.cycle('<1>', '<2>') }}{% endfor %}{%
            for item in seq %}{{ loop.cycle(*through) }}{% endfor %}"""
        )
>       output = tmpl.render(seq=list(range(4)), through=("<1>", "<2>"))

tests/test_core_tags.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ TestForLoop.test_lookaround __________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d58a0>
env = <jinja2.environment.Environment object at 0x7f5c4d03e830>

    def test_lookaround(self, env):
        tmpl = env.from_string(
            """{% for item in seq -%}
            {{ loop.previtem|default('x') }}-{{ item }}-{{
            loop.nextitem|default('x') }}|
        {%- endfor %}"""
        )
>       output = tmpl.render(seq=list(range(4)))

tests/test_core_tags.py:85: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________________ TestForLoop.test_changed ___________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d5bd0>
env = <jinja2.environment.Environment object at 0x7f5c4ce24970>

    def test_changed(self, env):
        tmpl = env.from_string(
            """{% for item in seq -%}
            {{ loop.changed(item) }},
        {%- endfor %}"""
        )
>       output = tmpl.render(seq=[None, None, 1, 2, 2, 3, 4, 4, 4])

tests/test_core_tags.py:94: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________________ TestForLoop.test_recursive __________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d6890>
env = <jinja2.environment.Environment object at 0x7f5c4cffa1a0>

    def test_recursive(self, env):
        tmpl = env.from_string(
            """{% for item in seq recursive -%}
            [{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]
        {%- endfor %}"""
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[1<[1][2]>][2<[1][2]>][3<[a]>]"
        )

tests/test_core_tags.py:118: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'item' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestForLoop.test_recursive_lookaround _____________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d6bc0>
env = <jinja2.environment.Environment object at 0x7f5c4cfd29b0>

    def test_recursive_lookaround(self, env):
        tmpl = env.from_string(
            """{% for item in seq recursive -%}
            [{{ loop.previtem.a if loop.previtem is defined else 'x' }}.{{
            item.a }}.{{ loop.nextitem.a if loop.nextitem is defined else 'x'
            }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]
        {%- endfor %}"""
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[x.1.2<[x.1.2][1.2.x]>][1.2.3<[x.1.2][1.2.x]>][2.3.x<[x.a.x]>]"
        )

tests/test_core_tags.py:137: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:904: in _eval_expr
    if m: return _eval_expr(m.group(1),ctx,env) if _eval_expr(m.group(2),ctx,env) else _eval_expr(m.group(3),ctx,env)
src/jinja2/environment.py:907: in _eval_expr
    val=_eval_expr(m.group(1),ctx,env); args=[_eval_expr(a,ctx,env) for a in _split_top(m.group(4) or '', ',') if a]
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestForLoop.test_recursive_depth0 _______________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2adb70>
env = <jinja2.environment.Environment object at 0x7f5c4cf63640>

    def test_recursive_depth0(self, env):
        tmpl = env.from_string(
            """{% for item in seq recursive -%}
        [{{ loop.depth0 }}:{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]
        {%- endfor %}"""
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[0:1<[1:1][1:2]>][0:2<[1:1][1:2]>][0:3<[1:a]>]"
        )

tests/test_core_tags.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestForLoop.test_recursive_depth _______________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d6a40>
env = <jinja2.environment.Environment object at 0x7f5c4cdc06d0>

    def test_recursive_depth(self, env):
        tmpl = env.from_string(
            """{% for item in seq recursive -%}
        [{{ loop.depth }}:{{ item.a }}{% if item.b %}<{{ loop(item.b) }}>{% endif %}]
        {%- endfor %}"""
        )
        assert (
>           tmpl.render(
                seq=[
                    dict(a=1, b=[dict(a=1), dict(a=2)]),
                    dict(a=2, b=[dict(a=1), dict(a=2)]),
                    dict(a=3, b=[dict(a="a")]),
                ]
            )
            == "[1:1<[2:1][2:2]>][1:2<[2:1][2:2]>][1:3<[2:a]>]"
        )

tests/test_core_tags.py:171: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________________ TestForLoop.test_looploop ___________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d6350>
env = <jinja2.environment.Environment object at 0x7f5c4cf73cd0>

    def test_looploop(self, env):
        tmpl = env.from_string(
            """{% for row in table %}
            {%- set rowloop = loop -%}
            {% for cell in row -%}
                [{{ rowloop.index }}|{{ loop.index }}]
            {%- endfor %}
        {%- endfor %}"""
        )
>       assert tmpl.render(table=["ab", "cd"]) == "[1|1][1|2][2|1][2|2]"

tests/test_core_tags.py:190: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestForLoop.test_reversed_bug _________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d6200>
env = <jinja2.environment.Environment object at 0x7f5c4d03f250>

    def test_reversed_bug(self, env):
        tmpl = env.from_string(
            "{% for i in items %}{{ i }}"
            "{% if not loop.last %}"
            ",{% endif %}{% endfor %}"
        )
>       assert tmpl.render(items=reversed([3, 2, 1])) == "1,2,3"

tests/test_core_tags.py:198: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ TestForLoop.test_loop_errors _________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d5a80>
env = <jinja2.environment.Environment object at 0x7f5c4cbac550>

    def test_loop_errors(self, env):
        tmpl = env.from_string(
            """{% for item in [1] if loop.index
                                      == 0 %}...{% endfor %}"""
        )
>       pytest.raises(UndefinedError, tmpl.render)

tests/test_core_tags.py:205: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '[1] if loop.index'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cbac550>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           [1] if loop.index
E           ^^^^^^^^^^^^^^^^^
E       SyntaxError: expected 'else' after 'if' expression

src/jinja2/environment.py:915: SyntaxError
_________________________ TestForLoop.test_loop_filter _________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d5390>
env = <jinja2.environment.Environment object at 0x7f5c4ce7e5f0>

    def test_loop_filter(self, env):
        tmpl = env.from_string(
            "{% for item in range(10) if item is even %}[{{ item }}]{% endfor %}"
        )
>       assert tmpl.render() == "[0][2][4][6][8]"

tests/test_core_tags.py:216: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:907: in _eval_expr
    val=_eval_expr(m.group(1),ctx,env); args=[_eval_expr(a,ctx,env) for a in _split_top(m.group(4) or '', ',') if a]
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'range(10) if item'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4ce7e5f0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           range(10) if item
E           ^^^^^^^^^^^^^^^^^
E       SyntaxError: expected 'else' after 'if' expression

src/jinja2/environment.py:915: SyntaxError
______________________ TestForLoop.test_loop_unassignable ______________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d5000>
env = <jinja2.environment.Environment object at 0x7f5c4ce4e9b0>

    def test_loop_unassignable(self, env):
>       pytest.raises(
            TemplateSyntaxError, env.from_string, "{% for loop in seq %}...{% endfor %}"
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_core_tags.py:225: Failed
_____________________ TestForLoop.test_scoped_special_var ______________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d4b20>
env = <jinja2.environment.Environment object at 0x7f5c4cf5c220>

    def test_scoped_special_var(self, env):
        t = env.from_string(
            "{% for s in seq %}[{{ loop.first }}{% for c in s %}"
            "|{{ loop.first }}{% endfor %}]{% endfor %}"
        )
>       assert t.render(seq=("ab", "cd")) == "[True|True|False][False|True|False]"

tests/test_core_tags.py:234: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestForLoop.test_scoped_loop_var _______________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d7010>
env = <jinja2.environment.Environment object at 0x7f5c4cf249d0>

    def test_scoped_loop_var(self, env):
        t = env.from_string(
            "{% for x in seq %}{{ loop.first }}"
            "{% for y in seq %}{% endfor %}{% endfor %}"
        )
>       assert t.render(seq="ab") == "TrueFalse"

tests/test_core_tags.py:241: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________ TestForLoop.test_recursive_empty_loop_iter __________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d7340>
env = <jinja2.environment.Environment object at 0x7f5c4d05fb20>

    def test_recursive_empty_loop_iter(self, env):
        t = env.from_string(
            """
        {%- for item in foo recursive -%}{%- endfor -%}
        """
        )
>       assert t.render(dict(foo=[])) == ""

tests/test_core_tags.py:254: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'foo recursive'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': [], 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4d05fb20>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           foo recursive
E               ^^^^^^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________________ TestForLoop.test_call_in_loop _________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d7670>
env = <jinja2.environment.Environment object at 0x7f5c4d0408e0>

    def test_call_in_loop(self, env):
        t = env.from_string(
            """
        {%- macro do_something() -%}
            [{{ caller() }}]
        {%- endmacro %}
    
        {%- for i in [1, 2, 3] %}
            {%- call do_something() -%}
                {{ i }}
            {%- endcall %}
        {%- endfor -%}
        """
        )
>       assert t.render() == "[1][2][3]"

tests/test_core_tags.py:270: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'caller' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ TestForLoop.test_scoping_bug _________________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2d79a0>
env = <jinja2.environment.Environment object at 0x7f5c4cfd26b0>

    def test_scoping_bug(self, env):
        t = env.from_string(
            """
        {%- for item in foo %}...{{ item }}...{% endfor %}
        {%- macro item(a) %}...{{ a }}...{% endmacro %}
        {{- item(2) -}}
        """
        )
>       assert t.render(foo=(1,)) == "...1......2..."
E       AssertionError: assert '\n        .....       ......' == '...1......2...'
E         
E         - ...1......2...
E         + 
E         +         ...1...
E         +         ......

tests/test_core_tags.py:280: AssertionError
__________________ TestForLoop.test_intended_scoping_with_set __________________

self = <test_core_tags.TestForLoop object at 0x7f5c4d2f8040>
env = <jinja2.environment.Environment object at 0x7f5c4d2d5480>

    def test_intended_scoping_with_set(self, env):
        tmpl = env.from_string(
            "{% for item in seq %}{{ x }}{% set x = item %}{{ x }}{% endfor %}"
        )
>       assert tmpl.render(x=0, seq=[1, 2, 3]) == "010203"
E       AssertionError: assert '123' == '010203'
E         
E         - 010203
E         + 123

tests/test_core_tags.py:292: AssertionError
__________________________ TestIfCondition.test_elif ___________________________

self = <test_core_tags.TestIfCondition object at 0x7f5c4d2d7790>
env = <jinja2.environment.Environment object at 0x7f5c4cef1270>

    def test_elif(self, env):
        tmpl = env.from_string(
            """{% if false %}XXX{% elif true
            %}...{% else %}XXX{% endif %}"""
        )
>       assert tmpl.render() == "..."
E       AssertionError: assert '' == '...'
E         
E         - ...

tests/test_core_tags.py:311: AssertionError
________________________ TestIfCondition.test_elif_deep ________________________

self = <test_core_tags.TestIfCondition object at 0x7f5c4d2d7640>
env = <jinja2.environment.Environment object at 0x7f5c4cbafd30>

    def test_elif_deep(self, env):
        elifs = "\n".join(f"{{% elif a == {i} %}}{i}" for i in range(1, 1000))
        tmpl = env.from_string(f"{{% if a == 0 %}}0{elifs}{{% else %}}x{{% endif %}}")
        for x in (0, 10, 999):
>           assert tmpl.render(a=x).strip() == str(x)
E           AssertionError: assert '' == '10'
E             
E             - 10

tests/test_core_tags.py:317: AssertionError
________________________ TestIfCondition.test_complete _________________________

self = <test_core_tags.TestIfCondition object at 0x7f5c4d2d5780>
env = <jinja2.environment.Environment object at 0x7f5c4cef2710>

    def test_complete(self, env):
        tmpl = env.from_string(
            "{% if a %}A{% elif b %}B{% elif c == d %}C{% else %}D{% endif %}"
        )
>       assert tmpl.render(a=0, b=False, c=42, d=42.0) == "C"
E       AssertionError: assert '' == 'C'
E         
E         - C

tests/test_core_tags.py:332: AssertionError
____________________________ TestMacros.test_simple ____________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2ad030>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cbad510>

        def test_simple(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% macro say_hello(name) %}Hello {{ name }}!{% endmacro %}
    {{ say_hello('Peter') }}"""
            )
>           assert tmpl.render() == "Hello Peter!"
E           AssertionError: assert 'Hello !' == 'Hello Peter!'
E             
E             - Hello Peter!
E             + Hello !

tests/test_core_tags.py:348: AssertionError
___________________________ TestMacros.test_scoping ____________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f8460>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce727a0>

        def test_scoping(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% macro level1(data1) %}
    {% macro level2(data2) %}{{ data1 }}|{{ data2 }}{% endmacro %}
    {{ level2('bar') }}{% endmacro %}
    {{ level1('foo') }}"""
            )
>           assert tmpl.render() == "foo|bar"
E           AssertionError: assert '\n|' == 'foo|bar'
E             
E             - foo|bar
E             + 
E             + |

tests/test_core_tags.py:358: AssertionError
__________________________ TestMacros.test_arguments ___________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f8670>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce24a90>

        def test_arguments(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% macro m(a, b, c='c', d='d') %}{{ a }}|{{ b }}|{{ c }}|{{ d }}{% endmacro %}
    {{ m() }}|{{ m('a') }}|{{ m('a', 'b') }}|{{ m(1, 2, 3) }}"""
            )
>           assert tmpl.render() == "||c|d|a||c|d|a|b|c|d|1|2|3|d"
E           AssertionError: assert '|||' == '||c|d|a||c|d|a|b|c|d|1|2|3|d'
E             
E             - ||c|d|a||c|d|a|b|c|d|1|2|3|d
E             + |||

tests/test_core_tags.py:366: AssertionError
_________________ TestMacros.test_arguments_defaults_nonsense __________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f89a0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cc38400>

        def test_arguments_defaults_nonsense(self, env_trim):
>           pytest.raises(
                TemplateSyntaxError,
                env_trim.from_string,
                """\
    {% macro m(a, b=1, c) %}a={{ a }}, b={{ b }}, c={{ c }}{% endmacro %}""",
            )
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_core_tags.py:369: Failed
___________________ TestMacros.test_caller_defaults_nonsense ___________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f8cd0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cbd7d60>

        def test_caller_defaults_nonsense(self, env_trim):
>           pytest.raises(
                TemplateSyntaxError,
                env_trim.from_string,
                """\
    {% macro a() %}{{ caller() }}{% endmacro %}
    {% call(x, y=1, z) a() %}{% endcall %}""",
            )
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_core_tags.py:377: Failed
___________________________ TestMacros.test_varargs ____________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f9000>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cc3b280>

        def test_varargs(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% macro test() %}{{ varargs|join('|') }}{% endmacro %}\
    {{ test(1, 2, 3) }}"""
            )
>           assert tmpl.render() == "1|2|3"
E           AssertionError: assert '' == '1|2|3'
E             
E             - 1|2|3

tests/test_core_tags.py:391: AssertionError
_________________________ TestMacros.test_simple_call __________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f9330>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cf60310>

        def test_simple_call(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% macro test() %}[[{{ caller() }}]]{% endmacro %}\
    {% call test() %}data{% endcall %}"""
            )
>           assert tmpl.render() == "[[data]]"

tests/test_core_tags.py:399: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'caller' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ TestMacros.test_complex_call _________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f9660>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cce3d00>

        def test_complex_call(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% macro test() %}[[{{ caller('data') }}]]{% endmacro %}\
    {% call(data) test() %}{{ data }}{% endcall %}"""
            )
>           assert tmpl.render() == "[[data]]"

tests/test_core_tags.py:407: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = ('data',), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'caller' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestMacros.test_caller_undefined _______________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2f9990>
env_trim = <jinja2.environment.Environment object at 0x7f5c4d03e0e0>

        def test_caller_undefined(self, env_trim):
            tmpl = env_trim.from_string(
                """\
    {% set caller = 42 %}\
    {% macro test() %}{{ caller is not defined }}{% endmacro %}\
    {{ test() }}"""
            )
>           assert tmpl.render() == "True"
E           AssertionError: assert 'False' == 'True'
E             
E             - True
E             + False

tests/test_core_tags.py:416: AssertionError
___________________________ TestMacros.test_include ____________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2d6980>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce7c520>

    def test_include(self, env_trim):
        env_trim = Environment(
            loader=DictLoader(
                {"include": "{% macro test(foo) %}[{{ foo }}]{% endmacro %}"}
            )
        )
        tmpl = env_trim.from_string('{% from "include" import test %}{{ test("foo") }}')
>       assert tmpl.render() == "[foo]"

tests/test_core_tags.py:425: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = ('foo',), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'test' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________________ TestMacros.test_macro_api ___________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2d5210>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cce1d50>

    def test_macro_api(self, env_trim):
        tmpl = env_trim.from_string(
            "{% macro foo(a, b) %}{% endmacro %}"
            "{% macro bar() %}{{ varargs }}{{ kwargs }}{% endmacro %}"
            "{% macro baz() %}{{ caller() }}{% endmacro %}"
        )
>       assert tmpl.module.foo.arguments == ("a", "b")
E       AttributeError: 'NoneType' object has no attribute 'foo'

tests/test_core_tags.py:433: AttributeError
___________________________ TestMacros.test_callself ___________________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2d5540>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cead510>

    def test_callself(self, env_trim):
        tmpl = env_trim.from_string(
            "{% macro foo(x) %}{{ x }}{% if x > 1 %}|"
            "{{ foo(x - 1) }}{% endif %}{% endmacro %}"
            "{{ foo(5) }}"
        )
>       assert tmpl.render() == "5|4|3|2|1"

tests/test_core_tags.py:450: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:955: in _render_tokens
    body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (1,), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________ TestMacros.test_macro_defaults_self_ref ____________________

self = <test_core_tags.TestMacros object at 0x7f5c4d2d7460>
env = <jinja2.environment.Environment object at 0x7f5c4d05a4d0>

    def test_macro_defaults_self_ref(self, env):
        tmpl = env.from_string(
            """
            {%- set x = 42 %}
            {%- macro m(a, b=x, x=23) %}{{ a }}|{{ b }}|{{ x }}{% endmacro -%}
        """
        )
>       assert tmpl.module.m(1) == "1||23"
E       AttributeError: 'NoneType' object has no attribute 'm'

tests/test_core_tags.py:459: AttributeError
_____________________________ TestSet.test_normal ______________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2f9810>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce7fc40>

    def test_normal(self, env_trim):
        tmpl = env_trim.from_string("{% set foo = 1 %}{{ foo }}")
        assert tmpl.render() == "1"
>       assert tmpl.module.foo == 1
E       AttributeError: 'NoneType' object has no attribute 'foo'

tests/test_core_tags.py:469: AttributeError
______________________________ TestSet.test_block ______________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2f9120>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce3b370>

    def test_block(self, env_trim):
        tmpl = env_trim.from_string("{% set foo %}42{% endset %}{{ foo }}")
        assert tmpl.render() == "42"
>       assert tmpl.module.foo == "42"
E       AttributeError: 'NoneType' object has no attribute 'foo'

tests/test_core_tags.py:474: AttributeError
_________________________ TestSet.test_block_escaping __________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2f8fd0>

    def test_block_escaping(self):
        env = Environment(autoescape=True)
        tmpl = env.from_string(
            "{% set foo %}<em>{{ test }}</em>{% endset %}foo: {{ foo }}"
        )
>       assert tmpl.render(test="<unsafe>") == "foo: <em>&lt;unsafe&gt;</em>"

tests/test_core_tags.py:481: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf59900>
value = '<unsafe>'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
___________________________ TestSet.test_set_invalid ___________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2f86a0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce38af0>

    def test_set_invalid(self, env_trim):
>       pytest.raises(
            TemplateSyntaxError, env_trim.from_string, "{% set foo['bar'] = 1 %}"
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_core_tags.py:484: Failed
_______________________ TestSet.test_namespace_redefined _______________________

self = <test_core_tags.TestSet object at 0x7f5c4d2f81c0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce73dc0>

    def test_namespace_redefined(self, env_trim):
        tmpl = env_trim.from_string("{% set ns = namespace() %}{% set ns.bar = 'hi' %}")
>       exc_info = pytest.raises(TemplateRuntimeError, tmpl.render, namespace=dict)
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateRuntimeError'>

tests/test_core_tags.py:493: Failed
____________________________ TestSet.test_namespace ____________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2f9d50>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cbda4a0>

    def test_namespace(self, env_trim):
        tmpl = env_trim.from_string(
            "{% set ns = namespace() %}{% set ns.bar = '42' %}{{ ns.bar }}"
        )
>       assert tmpl.render() == "42"

tests/test_core_tags.py:500: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Namespace {}>, name = 'bar'

    def __getattribute__(self, name: str) -> t.Any:
        if name == '_Namespace__attrs':
            return object.__getattribute__(self, name)
        try: return self.__attrs[name]
>       except KeyError: raise AttributeError(name) from None
E       AttributeError: bar

src/jinja2/utils.py:266: AttributeError
_________________________ TestSet.test_init_namespace __________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2fa3b0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cbad4e0>

    def test_init_namespace(self, env_trim):
        tmpl = env_trim.from_string(
            "{% set ns = namespace(d, self=37) %}"
            "{% set ns.b = 42 %}"
            "{{ ns.a }}|{{ ns.self }}|{{ ns.b }}"
        )
>       assert tmpl.render(d={"a": 13}) == "13|37|42"

tests/test_core_tags.py:514: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <Namespace {'a': 13, 'self': 37}>, name = 'b'

    def __getattribute__(self, name: str) -> t.Any:
        if name == '_Namespace__attrs':
            return object.__getattribute__(self, name)
        try: return self.__attrs[name]
>       except KeyError: raise AttributeError(name) from None
E       AttributeError: b

src/jinja2/utils.py:266: AttributeError
_________________________ TestSet.test_namespace_loop __________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2fa6e0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cc39db0>

    def test_namespace_loop(self, env_trim):
        tmpl = env_trim.from_string(
            "{% set ns = namespace(found=false) %}"
            "{% for x in range(4) %}"
            "{% if x == v %}"
            "{% set ns.found = true %}"
            "{% endif %}"
            "{% endfor %}"
            "{{ ns.found }}"
        )
>       assert tmpl.render(v=3) == "True"
E       AssertionError: assert 'False' == 'True'
E         
E         - True
E         + False

tests/test_core_tags.py:526: AssertionError
_________________________ TestSet.test_namespace_macro _________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2faa10>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cf5e560>

    def test_namespace_macro(self, env_trim):
        tmpl = env_trim.from_string(
            "{% set ns = namespace() %}"
            "{% set ns.a = 13 %}"
            "{% macro magic(x) %}"
            "{% set x.b = 37 %}"
            "{% endmacro %}"
            "{{ magic(ns) }}"
            "{{ ns.a }}|{{ ns.b }}"
        )
>       assert tmpl.render() == "13|37"
E       AssertionError: assert '' == '13|37'
E         
E         - 13|37

tests/test_core_tags.py:539: AssertionError
_____________________ TestSet.test_block_escaping_filtered _____________________

self = <test_core_tags.TestSet object at 0x7f5c4d2fad40>

    def test_block_escaping_filtered(self):
        env = Environment(autoescape=True)
        tmpl = env.from_string(
            "{% set foo | trim %}<em>{{ test }}</em>    {% endset %}foo: {{ foo }}"
        )
>       assert tmpl.render(test="<unsafe>") == "foo: <em>&lt;unsafe&gt;</em>"

tests/test_core_tags.py:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cc3a800>
value = '<unsafe>'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
_________________________ TestSet.test_block_filtered __________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2d79d0>
env_trim = <jinja2.environment.Environment object at 0x7f5c4cef3be0>

    def test_block_filtered(self, env_trim):
        tmpl = env_trim.from_string(
            "{% set foo | trim | length | string %} 42    {% endset %}{{ foo }}"
        )
>       assert tmpl.render() == "2"
E       AssertionError: assert ' 42    ' == '2'
E         
E         - 2
E         +  42

tests/test_core_tags.py:552: AssertionError
_______________________ TestSet.test_block_filtered_set ________________________

self = <test_core_tags.TestSet object at 0x7f5c4d2d7430>
env_trim = <jinja2.environment.Environment object at 0x7f5c4ce7c220>

    def test_block_filtered_set(self, env_trim):
        def _myfilter(val, arg):
            assert arg == " xxx "
            return val
    
        env_trim.filters["myfilter"] = _myfilter
        tmpl = env_trim.from_string(
            '{% set a = " xxx " %}'
            "{% set foo | myfilter(a) | trim | length | string %}"
            ' {% set b = " yy " %} 42 {{ a }}{{ b }}   '
            "{% endset %}"
            "{{ foo }}"
        )
>       assert tmpl.render() == "11"
E       AssertionError: assert '  42  xxx  yy    ' == '11'
E         
E         - 11
E         +   42  xxx  yy

tests/test_core_tags.py:568: AssertionError
______________________________ TestWith.test_with ______________________________

self = <test_core_tags.TestWith object at 0x7f5c4d2adff0>
env = <jinja2.environment.Environment object at 0x7f5c4ceaf220>

    def test_with(self, env):
        tmpl = env.from_string(
            """\
        {% with a=42, b=23 -%}
            {{ a }} = {{ b }}
        {% endwith -%}
            {{ a }} = {{ b }}\
        """
        )
>       assert [x.strip() for x in tmpl.render(a=1, b=2).splitlines()] == [
            "42 = 23",
            "1 = 2",
        ]
E       AssertionError: assert ['', '1 = 2', ''] == ['42 = 23', '1 = 2']
E         
E         At index 0 diff: '' != '42 = 23'
E         Left contains one more item: ''
E         Use -v to get more diff

tests/test_core_tags.py:582: AssertionError
_____________________ TestWith.test_with_argument_scoping ______________________

self = <test_core_tags.TestWith object at 0x7f5c4d2fab30>
env = <jinja2.environment.Environment object at 0x7f5c4ce38af0>

    def test_with_argument_scoping(self, env):
        tmpl = env.from_string(
            """\
        {%- with a=1, b=2, c=b, d=e, e=5 -%}
            {{ a }}|{{ b }}|{{ c }}|{{ d }}|{{ e }}
        {%- endwith -%}
        """
        )
>       assert tmpl.render(b=3, e=4) == "1|2|3|4|5"
E       AssertionError: assert '        \n  ...||4\n        ' == '1|2|3|4|5'
E         
E         - 1|2|3|4|5
E         +         
E         +             |3|||4
E         +

tests/test_core_tags.py:595: AssertionError
_________________________ TestDebug.test_runtime_error _________________________

self = <test_debug.TestDebug object at 0x7f5c4d2f84f0>
fs_env = <jinja2.environment.Environment object at 0x7f5c4ce4dba0>

        def test_runtime_error(self, fs_env):
            def test():
                tmpl.render(fail=lambda: 1 / 0)
    
            tmpl = fs_env.get_template("broken.html")
>           self.assert_traceback_matches(
                test,
                r"""
      File ".*?broken.html", line 2, in (top-level template code|<module>)
        \{\{ fail\(\) \}\}(
        \^{12})?
      File ".*debug?.pyc?", line \d+, in <lambda>
        tmpl\.render\(fail=lambda: 1 / 0\)(
                                 ~~\^~~)?
    ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero
    """,
            )

tests/test_debug.py:35: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_debug.TestDebug object at 0x7f5c4d2f84f0>
callback = <function TestDebug.test_runtime_error.<locals>.test at 0x7f5c4ccafc70>
expected_tb = '\n  File ".*?broken.html", line 2, in (top-level template code|<module>)\n    \\{\\{ fail\\(\\) \\}\\}(\n    \\^{12})...a: 1 / 0\\)(\n                             ~~\\^~~)?\nZeroDivisionError: (int(eger)? )?division (or modulo )?by zero\n'

    def assert_traceback_matches(self, callback, expected_tb):
        with pytest.raises(Exception) as exc_info:
            callback()
    
        tb = format_exception(exc_info.type, exc_info.value, exc_info.tb)
        m = re.search(expected_tb.strip(), "".join(tb))
>       assert (
            m is not None
        ), f"Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}"
E       AssertionError: Traceback did not match:
E         
E         Traceback (most recent call last):
E           File "/workspace/jinja/tests/test_debug.py", line 22, in assert_traceback_matches
E             callback()
E           File "/workspace/jinja/tests/test_debug.py", line 32, in test
E             tmpl.render(fail=lambda: 1 / 0)
E         AttributeError: 'NoneType' object has no attribute 'render'
E         
E         expected:
E         
E           File ".*?broken.html", line 2, in (top-level template code|<module>)
E             \{\{ fail\(\) \}\}(
E             \^{12})?
E           File ".*debug?.pyc?", line \d+, in <lambda>
E             tmpl\.render\(fail=lambda: 1 / 0\)(
E                                      ~~\^~~)?
E         ZeroDivisionError: (int(eger)? )?division (or modulo )?by zero
E         
E       assert None is not None

tests/test_debug.py:26: AssertionError
_________________________ TestDebug.test_syntax_error __________________________

self = <test_debug.TestDebug object at 0x7f5c4d2f9150>
fs_env = <jinja2.environment.Environment object at 0x7f5c4cead7b0>

        def test_syntax_error(self, fs_env):
            # The trailing .*? is for PyPy 2 and 3, which don't seem to
            # clear the exception's original traceback, leaving the syntax
            # error in the middle of other compiler frames.
>           self.assert_traceback_matches(
                lambda: fs_env.get_template("syntaxerror.html"),
                """(?sm)
      File ".*?syntaxerror.html", line 4, in (template|<module>)
        \\{% endif %\\}.*?
    (jinja2\\.exceptions\\.)?TemplateSyntaxError: Encountered unknown tag 'endif'. Jinja \
    was looking for the following tags: 'endfor' or 'else'. The innermost block that needs \
    to be closed is 'for'.
        """,
            )

tests/test_debug.py:52: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_debug.TestDebug object at 0x7f5c4d2f9150>
callback = <function TestDebug.test_syntax_error.<locals>.<lambda> at 0x7f5c4ca8d2d0>
expected_tb = '(?sm)\n  File ".*?syntaxerror.html", line 4, in (template|<module>)\n    \\{% endif %\\}.*?\n(jinja2\\.exceptions\\.)... looking for the following tags: \'endfor\' or \'else\'. The innermost block that needs to be closed is \'for\'.\n    '

    def assert_traceback_matches(self, callback, expected_tb):
>       with pytest.raises(Exception) as exc_info:
E       Failed: DID NOT RAISE <class 'Exception'>

tests/test_debug.py:21: Failed
_____________________ TestDebug.test_regular_syntax_error ______________________

self = <test_debug.TestDebug object at 0x7f5c4d2f99c0>
fs_env = <jinja2.environment.Environment object at 0x7f5c4ce4d8d0>

        def test_regular_syntax_error(self, fs_env):
            def test():
                raise TemplateSyntaxError("wtf", 42)
    
>           self.assert_traceback_matches(
                test,
                r"""
      File ".*debug.pyc?", line \d+, in test
        raise TemplateSyntaxError\("wtf", 42\)(
        \^{36})?
    (jinja2\.exceptions\.)?TemplateSyntaxError: wtf
      line 42""",
            )

tests/test_debug.py:67: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_debug.TestDebug object at 0x7f5c4d2f99c0>
callback = <function TestDebug.test_regular_syntax_error.<locals>.test at 0x7f5c4ca8cdc0>
expected_tb = '\n  File ".*debug.pyc?", line \\d+, in test\n    raise TemplateSyntaxError\\("wtf", 42\\)(\n    \\^{36})?\n(jinja2\\.exceptions\\.)?TemplateSyntaxError: wtf\n  line 42'

    def assert_traceback_matches(self, callback, expected_tb):
        with pytest.raises(Exception) as exc_info:
            callback()
    
        tb = format_exception(exc_info.type, exc_info.value, exc_info.tb)
        m = re.search(expected_tb.strip(), "".join(tb))
>       assert (
            m is not None
        ), f"Traceback did not match:\n\n{''.join(tb)}\nexpected:\n{expected_tb}"
E       AssertionError: Traceback did not match:
E         
E         Traceback (most recent call last):
E           File "/workspace/jinja/tests/test_debug.py", line 22, in assert_traceback_matches
E             callback()
E           File "/workspace/jinja/tests/test_debug.py", line 65, in test
E             raise TemplateSyntaxError("wtf", 42)
E         jinja2.exceptions.TemplateSyntaxError: <exception str() failed>
E         
E         expected:
E         
E           File ".*debug.pyc?", line \d+, in test
E             raise TemplateSyntaxError\("wtf", 42\)(
E             \^{36})?
E         (jinja2\.exceptions\.)?TemplateSyntaxError: wtf
E           line 42
E       assert None is not None

tests/test_debug.py:26: AssertionError
____________________ TestDebug.test_pickleable_syntax_error ____________________

self = <test_debug.TestDebug object at 0x7f5c4d2fb340>
fs_env = <jinja2.environment.Environment object at 0x7f5c4ce72e00>

    def test_pickleable_syntax_error(self, fs_env):
        original = TemplateSyntaxError("bad template", 42, "test", "test.txt")
>       unpickled = pickle.loads(pickle.dumps(original))

tests/test_debug.py:79: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = TemplateSyntaxError('bad template')

    def __reduce__(self):
>       return (self.__class__, (self.message, self.lineno, self.name, self.filename))
E       AttributeError: 'TemplateSyntaxError' object has no attribute 'message'

src/jinja2/exceptions.py:89: AttributeError
__________________ TestDebug.test_include_syntax_error_source __________________

self = <test_debug.TestDebug object at 0x7f5c4d2fb670>
filesystem_loader = <jinja2.loaders.FileSystemLoader object at 0x7f5c4cf5ce80>

    def test_include_syntax_error_source(self, filesystem_loader):
        e = Environment(
            loader=ChoiceLoader(
                [
                    filesystem_loader,
                    DictLoader({"inc": "a\n{% include 'syntaxerror.html' %}\nb"}),
                ]
            )
        )
        t = e.get_template("inc")
    
        with pytest.raises(TemplateSyntaxError) as exc_info:
>           t.render()
E           AttributeError: 'NoneType' object has no attribute 'render'

tests/test_debug.py:95: AttributeError
_______________________ TestDebug.test_local_extraction ________________________

self = <test_debug.TestDebug object at 0x7f5c4d2fb9a0>

    def test_local_extraction(self):
        from jinja2.debug import get_template_locals
        from jinja2.runtime import missing
    
        locals = get_template_locals(
            {
                "l_0_foo": 42,
                "l_1_foo": 23,
                "l_2_foo": 13,
                "l_0_bar": 99,
                "l_1_bar": missing,
                "l_0_baz": missing,
            }
        )
>       assert locals == {"foo": 13, "bar": 99}
E       AssertionError: assert {'0_bar': 99,... missing, ...} == {'bar': 99, 'foo': 13}
E         
E         Left contains 6 more items:
E         {'0_bar': 99,
E          '0_baz': missing,
E          '0_foo': 42,
E          '1_bar': missing,
E          '1_foo': 23,...
E         
E         ...Full output truncated (4 lines hidden), use '-vv' to show

tests/test_debug.py:113: AssertionError
______________ TestDebug.test_get_corresponding_lineno_traceback _______________

self = <test_debug.TestDebug object at 0x7f5c4d2fbca0>
fs_env = <jinja2.environment.Environment object at 0x7f5c4ce4fa00>

    def test_get_corresponding_lineno_traceback(self, fs_env):
        tmpl = fs_env.get_template("test.html")
>       assert tmpl.get_corresponding_lineno(1) == 1
E       AttributeError: 'NoneType' object has no attribute 'get_corresponding_lineno'

tests/test_debug.py:117: AttributeError
_______________________ TestExtensions.test_extend_late ________________________

self = <test_ext.TestExtensions object at 0x7f5c4d329a20>

    def test_extend_late(self):
        env = Environment()
        t = env.from_string('{% autoescape true %}{{ "<test>" }}{% endautoescape %}')
>       assert t.render() == "&lt;test&gt;"
E       AssertionError: assert '<test>' == '&lt;test&gt;'
E         
E         - &lt;test&gt;
E         + <test>

tests/test_ext.py:223: AssertionError
______________________ TestExtensions.test_loop_controls _______________________

self = <test_ext.TestExtensions object at 0x7f5c4d329cf0>

    def test_loop_controls(self):
        env = Environment(extensions=["jinja2.ext.loopcontrols"])
    
        tmpl = env.from_string(
            """
            {%- for item in [1, 2, 3, 4] %}
                {%- if item % 2 == 0 %}{% continue %}{% endif -%}
                {{ item }}
            {%- endfor %}"""
        )
>       assert tmpl.render() == "13"

tests/test_ext.py:235: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (2,), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'item' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________________ TestExtensions.test_do ____________________________

self = <test_ext.TestExtensions object at 0x7f5c4d329fc0>

    def test_do(self):
        env = Environment(extensions=["jinja2.ext.do"])
        tmpl = env.from_string(
            """
            {%- set items = [] %}
            {%- for char in "foo" %}
                {%- do items.append(loop.index0 ~ char) %}
            {%- endfor %}{{ items|join(', ') }}"""
        )
>       assert tmpl.render() == "0f, 1o, 2o"
E       AssertionError: assert '\n          ...n            ' == '0f, 1o, 2o'
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '0f, 1o, 2o'
E         + '\n            \n            \n                \n            \n                \n            \n                \n            '

tests/test_ext.py:255: AssertionError
_____________________ TestExtensions.test_extension_nodes ______________________

self = <test_ext.TestExtensions object at 0x7f5c4d32a290>

    def test_extension_nodes(self):
        env = Environment(extensions=[ExampleExtension])
        tmpl = env.from_string("{% test %}")
>       assert tmpl.render() == "False|42|23|{}|None"
E       AssertionError: assert '' == 'False|42|23|{}|None'
E         
E         - False|42|23|{}|None

tests/test_ext.py:260: AssertionError
___________ TestExtensions.test_contextreference_node_passes_context ___________

self = <test_ext.TestExtensions object at 0x7f5c4d32a560>

    def test_contextreference_node_passes_context(self):
        env = Environment(extensions=[ExampleExtension])
        tmpl = env.from_string('{% set test_var="test_content" %}{% test %}')
>       assert tmpl.render() == "False|42|23|{}|test_content"
E       AssertionError: assert '' == 'False|42|23|{}|test_content'
E         
E         - False|42|23|{}|test_content

tests/test_ext.py:265: AssertionError
__________ TestExtensions.test_contextreference_node_can_pass_locals ___________

self = <test_ext.TestExtensions object at 0x7f5c4d32a1a0>

    def test_contextreference_node_can_pass_locals(self):
        env = Environment(extensions=[DerivedExampleExtension])
        tmpl = env.from_string(
            '{% for test_var in ["test_content"] %}{% test %}{% endfor %}'
        )
>       assert tmpl.render() == "False|42|23|{}|test_content"
E       AssertionError: assert '' == 'False|42|23|{}|test_content'
E         
E         - False|42|23|{}|test_content

tests/test_ext.py:272: AssertionError
________________________ TestExtensions.test_rebinding _________________________

self = <test_ext.TestExtensions object at 0x7f5c4d329930>

    def test_rebinding(self):
        original = Environment(extensions=[ExampleExtension])
        overlay = original.overlay()
        for env in original, overlay:
>           for ext in env.extensions.values():
E           AttributeError: 'NoneType' object has no attribute 'extensions'

tests/test_ext.py:281: AttributeError
__________________ TestExtensions.test_preprocessor_extension __________________

self = <test_ext.TestExtensions object at 0x7f5c4d32a7d0>

    def test_preprocessor_extension(self):
        env = Environment(extensions=[PreprocessorExtension])
        tmpl = env.from_string("{[[TEST]]}")
>       assert tmpl.render(foo=42) == "{(42)}"
E       AssertionError: assert '{[[TEST]]}' == '{(42)}'
E         
E         - {(42)}
E         + {[[TEST]]}

tests/test_ext.py:287: AssertionError
__________________ TestExtensions.test_streamfilter_extension __________________

self = <test_ext.TestExtensions object at 0x7f5c4d32aaa0>

    def test_streamfilter_extension(self):
        env = Environment(extensions=[StreamFilterExtension])
        env.globals["gettext"] = lambda x: x.upper()
        tmpl = env.from_string("Foo _(bar) Baz")
        out = tmpl.render()
>       assert out == "Foo BAR Baz"
E       AssertionError: assert 'Foo _(bar) Baz' == 'Foo BAR Baz'
E         
E         - Foo BAR Baz
E         + Foo _(bar) Baz

tests/test_ext.py:294: AssertionError
____________________ TestExtensions.test_extension_ordering ____________________

self = <test_ext.TestExtensions object at 0x7f5c4d32ad70>

    def test_extension_ordering(self):
        class T1(Extension):
            priority = 1
    
        class T2(Extension):
            priority = 2
    
        env = Environment(extensions=[T1, T2])
>       ext = list(env.iter_extensions())
E       TypeError: 'NoneType' object is not iterable

tests/test_ext.py:304: TypeError
__________________________ TestExtensions.test_debug ___________________________

self = <test_ext.TestExtensions object at 0x7f5c4d32b040>

    def test_debug(self):
        env = Environment(extensions=["jinja2.ext.debug"])
        t = env.from_string("Hello\n{% debug %}\nGoodbye")
        out = t.render()
    
        for value in ("context", "cycler", "filters", "abs", "tests", "!="):
>           assert f"'{value}'" in out
E           assert "'context'" in 'Hello\n\nGoodbye'

tests/test_ext.py:314: AssertionError
_____________________ TestInternationalization.test_trans ______________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32b3d0>

    def test_trans(self):
        tmpl = i18n_env.get_template("child.html")
>       assert tmpl.render(LANGUAGE="de") == "<title>fehlend</title>pass auf"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:320: AttributeError
__________________ TestInternationalization.test_trans_plural __________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32b6a0>

    def test_trans_plural(self):
        tmpl = i18n_env.get_template("plural.html")
>       assert tmpl.render(LANGUAGE="de", user_count=1) == "Ein Benutzer online"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:324: AttributeError
__________ TestInternationalization.test_trans_plural_with_functions ___________

self = <test_ext.TestInternationalization object at 0x7f5c4d32b970>

    def test_trans_plural_with_functions(self):
        tmpl = i18n_env.get_template("plural2.html")
    
        def get_user_count():
            get_user_count.called += 1
            return 1
    
        get_user_count.called = 0
>       assert tmpl.render(LANGUAGE="de", get_user_count=get_user_count) == "1s"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:335: AttributeError
_________________ TestInternationalization.test_complex_plural _________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32bc40>

    def test_complex_plural(self):
        tmpl = i18n_env.from_string(
            "{% trans foo=42, count=2 %}{{ count }} item{% "
            "pluralize count %}{{ count }} items{% endtrans %}"
        )
>       assert tmpl.render() == "2 items"
E       AssertionError: assert ' item items' == '2 items'
E         
E         - 2 items
E         +  item items

tests/test_ext.py:343: AssertionError
_____________ TestInternationalization.test_trans_stringformatting _____________

self = <test_ext.TestInternationalization object at 0x7f5c4d32bf10>

    def test_trans_stringformatting(self):
        tmpl = i18n_env.get_template("stringformat.html")
>       assert tmpl.render(LANGUAGE="de", user_count=5) == "Benutzer: 5"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:352: AttributeError
____________________ TestInternationalization.test_trimmed _____________________

self = <test_ext.TestInternationalization object at 0x7f5c4d35c220>

    def test_trimmed(self):
        tmpl = i18n_env.from_string(
            "{%- trans trimmed %}  hello\n  world  {% endtrans -%}"
        )
>       assert tmpl.render() == "hello world"
E       AssertionError: assert '  hello\n  world  ' == 'hello world'
E         
E         - hello world
E         +   hello
E         +   world

tests/test_ext.py:358: AssertionError
_________________ TestInternationalization.test_trimmed_policy _________________

self = <test_ext.TestInternationalization object at 0x7f5c4d35c4f0>

    def test_trimmed_policy(self):
        s = "{%- trans %}  hello\n  world  {% endtrans -%}"
        tmpl = i18n_env.from_string(s)
        trimmed_tmpl = i18n_env_trimmed.from_string(s)
        assert tmpl.render() == "  hello\n  world  "
>       assert trimmed_tmpl.render() == "hello world"
E       AssertionError: assert '  hello\n  world  ' == 'hello world'
E         
E         - hello world
E         +   hello
E         +   world

tests/test_ext.py:365: AssertionError
__________________ TestInternationalization.test_trimmed_vars __________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32bb80>

    def test_trimmed_vars(self):
        tmpl = i18n_env.from_string(
            '{%- trans trimmed x="world" %}  hello\n  {{ x }} {% endtrans -%}'
        )
>       assert tmpl.render() == "hello world"
E       AssertionError: assert '  hello\n   ' == 'hello world'
E         
E         - hello world
E         +   hello
E         +

tests/test_ext.py:377: AssertionError
____________ TestInternationalization.test_trimmed_varname_trimmed _____________

self = <test_ext.TestInternationalization object at 0x7f5c4d32b880>

    def test_trimmed_varname_trimmed(self):
        # unlikely variable name, but when used as a variable
        # it should not enable trimming
        tmpl = i18n_env.from_string(
            "{%- trans trimmed = 'world' %}  hello\n  {{ trimmed }}  {% endtrans -%}"
        )
>       assert tmpl.render() == "  hello\n  world  "
E       AssertionError: assert '  hello\n    ' == '  hello\n  world  '
E         
E             hello
E         -   world  
E         +

tests/test_ext.py:385: AssertionError
____________________ TestInternationalization.test_extract _____________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32b310>

    def test_extract(self):
        from jinja2.ext import babel_extract
    
        source = BytesIO(
            b"""
            {{ gettext('Hello World') }}
            {% trans %}Hello World{% endtrans %}
            {% trans %}{{ users }} user{% pluralize %}{{ users }} users{% endtrans %}
            """
        )
>       assert list(babel_extract(source, ("gettext", "ngettext", "_"), [], {})) == [
            (2, "gettext", "Hello World", []),
            (3, "gettext", "Hello World", []),
            (4, "ngettext", ("%(users)s user", "%(users)s users", None), []),
        ]
E       TypeError: 'NoneType' object is not iterable

tests/test_ext.py:397: TypeError
________________ TestInternationalization.test_extract_trimmed _________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32af50>

    def test_extract_trimmed(self):
        from jinja2.ext import babel_extract
    
        source = BytesIO(
            b"""
            {{ gettext(' Hello  \n  World') }}
            {% trans trimmed %} Hello  \n  World{% endtrans %}
            {% trans trimmed %}{{ users }} \n user
            {%- pluralize %}{{ users }} \n users{% endtrans %}
            """
        )
>       assert list(babel_extract(source, ("gettext", "ngettext", "_"), [], {})) == [
            (2, "gettext", " Hello  \n  World", []),
            (4, "gettext", "Hello World", []),
            (6, "ngettext", ("%(users)s user", "%(users)s users", None), []),
        ]
E       TypeError: 'NoneType' object is not iterable

tests/test_ext.py:414: TypeError
_____________ TestInternationalization.test_extract_trimmed_option _____________

self = <test_ext.TestInternationalization object at 0x7f5c4d32a9e0>

    def test_extract_trimmed_option(self):
        from jinja2.ext import babel_extract
    
        source = BytesIO(
            b"""
            {{ gettext(' Hello  \n  World') }}
            {% trans %} Hello  \n  World{% endtrans %}
            {% trans %}{{ users }} \n user
            {%- pluralize %}{{ users }} \n users{% endtrans %}
            """
        )
        opts = {"trimmed": "true"}
>       assert list(babel_extract(source, ("gettext", "ngettext", "_"), [], opts)) == [
            (2, "gettext", " Hello  \n  World", []),
            (4, "gettext", "Hello World", []),
            (6, "ngettext", ("%(users)s user", "%(users)s users", None), []),
        ]
E       TypeError: 'NoneType' object is not iterable

tests/test_ext.py:432: TypeError
________________ TestInternationalization.test_comment_extract _________________

self = <test_ext.TestInternationalization object at 0x7f5c4d32a6e0>

    def test_comment_extract(self):
        from jinja2.ext import babel_extract
    
        source = BytesIO(
            b"""
            {# trans first #}
            {{ gettext('Hello World') }}
            {% trans %}Hello World{% endtrans %}{# trans second #}
            {#: third #}
            {% trans %}{{ users }} user{% pluralize %}{{ users }} users{% endtrans %}
            """
        )
>       assert list(
            babel_extract(source, ("gettext", "ngettext", "_"), ["trans", ":"], {})
        ) == [
            (3, "gettext", "Hello World", ["first"]),
            (4, "gettext", "Hello World", ["second"]),
            (6, "ngettext", ("%(users)s user", "%(users)s users", None), ["third"]),
        ]
E       TypeError: 'NoneType' object is not iterable

tests/test_ext.py:450: TypeError
________________ TestInternationalization.test_extract_context _________________

self = <test_ext.TestInternationalization object at 0x7f5c4d329f30>

    def test_extract_context(self):
        from jinja2.ext import babel_extract
    
        source = BytesIO(
            b"""
             {{ pgettext("babel", "Hello World") }}
             {{ npgettext("babel", "%(users)s user", "%(users)s users", users) }}
             """
        )
>       assert list(babel_extract(source, ("pgettext", "npgettext", "_"), [], {})) == [
            (2, "pgettext", ("babel", "Hello World"), []),
            (3, "npgettext", ("babel", "%(users)s user", "%(users)s users", None), []),
        ]
E       TypeError: 'NoneType' object is not iterable

tests/test_ext.py:467: TypeError
_______________ TestInternationalization.test_nested_trans_error _______________

self = <test_ext.TestInternationalization object at 0x7f5c4d32a1d0>

    def test_nested_trans_error(self):
        s = "{% trans %}foo{% trans %}{% endtrans %}"
>       with pytest.raises(TemplateSyntaxError) as excinfo:
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_ext.py:474: Failed
_______________ TestInternationalization.test_trans_block_error ________________

self = <test_ext.TestInternationalization object at 0x7f5c4d2acca0>

    def test_trans_block_error(self):
        s = "{% trans %}foo{% wibble bar %}{% endwibble %}{% endtrans %}"
>       with pytest.raises(TemplateSyntaxError) as excinfo:
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_ext.py:480: Failed
_____________________ TestScope.test_basic_scope_behavior ______________________

self = <test_ext.TestScope object at 0x7f5c4d35c610>

    def test_basic_scope_behavior(self):
        # This is what the old with statement compiled down to
        class ScopeExt(Extension):
            tags = {"scope"}
    
            def parse(self, parser):
                node = nodes.Scope(lineno=next(parser.stream).lineno)
                assignments = []
                while parser.stream.current.type != "block_end":
                    lineno = parser.stream.current.lineno
                    if assignments:
                        parser.stream.expect("comma")
                    target = parser.parse_assign_target()
                    parser.stream.expect("assign")
                    expr = parser.parse_expression()
                    assignments.append(nodes.Assign(target, expr, lineno=lineno))
                node.body = assignments + list(
                    parser.parse_statements(("name:endscope",), drop_needle=True)
                )
                return node
    
        env = Environment(extensions=[ScopeExt])
        tmpl = env.from_string(
            """\
        {%- scope a=1, b=2, c=b, d=e, e=5 -%}
            {{ a }}|{{ b }}|{{ c }}|{{ d }}|{{ e }}
        {%- endscope -%}
        """
        )
>       assert tmpl.render(b=3, e=4) == "1|2|2|4|5"
E       AssertionError: assert '        \n  ...||4\n        ' == '1|2|2|4|5'
E         
E         - 1|2|2|4|5
E         +         
E         +             |3|||4
E         +

tests/test_ext.py:515: AssertionError
_________________ TestNewstyleInternationalization.test_trans __________________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d35c070>

    def test_trans(self):
        tmpl = newstyle_i18n_env.get_template("child.html")
>       assert tmpl.render(LANGUAGE="de") == "<title>fehlend</title>pass auf"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:521: AttributeError
______________ TestNewstyleInternationalization.test_trans_plural ______________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d35ca00>

    def test_trans_plural(self):
        tmpl = newstyle_i18n_env.get_template("plural.html")
>       assert tmpl.render(LANGUAGE="de", user_count=1) == "Ein Benutzer online"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:525: AttributeError
_____________ TestNewstyleInternationalization.test_complex_plural _____________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d35ccd0>

    def test_complex_plural(self):
        tmpl = newstyle_i18n_env.from_string(
            "{% trans foo=42, count=2 %}{{ count }} item{% "
            "pluralize count %}{{ count }} items{% endtrans %}"
        )
>       assert tmpl.render() == "2 items"
E       AssertionError: assert ' item items' == '2 items'
E         
E         - 2 items
E         +  item items

tests/test_ext.py:533: AssertionError
_________ TestNewstyleInternationalization.test_trans_stringformatting _________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d35cfa0>

    def test_trans_stringformatting(self):
        tmpl = newstyle_i18n_env.get_template("stringformat.html")
>       assert tmpl.render(LANGUAGE="de", user_count=5) == "Benutzer: 5"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:542: AttributeError
____________ TestNewstyleInternationalization.test_newstyle_plural _____________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d35d270>

    def test_newstyle_plural(self):
        tmpl = newstyle_i18n_env.get_template("ngettext.html")
>       assert tmpl.render(LANGUAGE="de", apples=1) == "1 Apfel"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:546: AttributeError
___________ TestNewstyleInternationalization.test_autoescape_support ___________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d2f9c60>

    def test_autoescape_support(self):
        env = Environment(extensions=["jinja2.ext.i18n"])
        env.install_gettext_callables(
            lambda x: "<strong>Wert: %(name)s</strong>",
            lambda s, p, n: s,
            newstyle=True,
        )
        t = env.from_string(
            '{% autoescape ae %}{{ gettext("foo", name='
            '"<test>") }}{% endautoescape %}'
        )
>       assert t.render(ae=True) == "<strong>Wert: &lt;test&gt;</strong>"

tests/test_ext.py:560: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: TestNewstyleInternationalization.test_autoescape_support.<locals>.<lambda>() got an unexpected keyword argument 'name'

<string>:1: TypeError
_____________ TestNewstyleInternationalization.test_num_used_twice _____________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32a3e0>

    def test_num_used_twice(self):
        tmpl = newstyle_i18n_env.get_template("ngettext_long.html")
>       assert tmpl.render(apples=5, LANGUAGE="de") == "5 Äpfel"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:573: AttributeError
_____________ TestNewstyleInternationalization.test_num_called_num _____________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32b400>

    def test_num_called_num(self):
        source = newstyle_i18n_env.compile(
            """
            {% trans num=3 %}{{ num }} apple{% pluralize
            %}{{ num }} apples{% endtrans %}
        """,
            raw=True,
        )
        # quite hacky, but the only way to properly test that.  The idea is
        # that the generated code does not pass num twice (although that
        # would work) for better performance.  This only works on the
        # newstyle gettext of course
        assert (
>           re.search(r"u?'%\(num\)s apple', u?'%\(num\)s apples', 3", source)
            is not None
        )

tests/test_ext.py:588: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

pattern = "u?'%\\(num\\)s apple', u?'%\\(num\\)s apples', 3", string = None
flags = 0

    def search(pattern, string, flags=0):
        """Scan through string looking for a match to the pattern, returning
        a Match object, or None if no match was found."""
>       return _compile(pattern, flags).search(string)
E       TypeError: expected string or bytes-like object

/usr/lib/python3.10/re.py:200: TypeError
_______________ TestNewstyleInternationalization.test_trans_vars _______________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32a0e0>

    def test_trans_vars(self):
        t1 = newstyle_i18n_env.get_template("transvars1.html")
        t2 = newstyle_i18n_env.get_template("transvars2.html")
        t3 = newstyle_i18n_env.get_template("transvars3.html")
>       assert t1.render(num=1, LANGUAGE="de") == "Benutzer: 1"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:596: AttributeError
__________ TestNewstyleInternationalization.test_novars_vars_escaping __________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32a620>

    def test_novars_vars_escaping(self):
        t = newstyle_i18n_env.get_template("novars.html")
>       assert t.render() == "%(hello)s"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:602: AttributeError
________________ TestNewstyleInternationalization.test_context _________________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32ac80>

    def test_context(self):
        tmpl = newstyle_i18n_env.get_template("pgettext.html")
>       assert tmpl.render(LANGUAGE="de") == "Apple"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:610: AttributeError
_____________ TestNewstyleInternationalization.test_context_plural _____________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32b610>

    def test_context_plural(self):
        tmpl = newstyle_i18n_env.get_template("npgettext.html")
>       assert tmpl.render(LANGUAGE="de", apples=1) == "1 Apple"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:614: AttributeError
_____________ TestNewstyleInternationalization.test_context_block ______________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d32b8b0>

    def test_context_block(self):
        tmpl = newstyle_i18n_env.get_template("pgettext_block")
>       assert tmpl.render(LANGUAGE="de") == "Apple"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:619: AttributeError
__________ TestNewstyleInternationalization.test_context_plural_block __________

self = <test_ext.TestNewstyleInternationalization object at 0x7f5c4d447640>

    def test_context_plural_block(self):
        tmpl = newstyle_i18n_env.get_template("npgettext_block")
>       assert tmpl.render(LANGUAGE="de", apples=1) == "1 Apple"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_ext.py:623: AttributeError
______________________ TestAutoEscape.test_scoped_setting ______________________

self = <test_ext.TestAutoEscape object at 0x7f5c4d35d1b0>

    def test_scoped_setting(self):
        env = Environment(autoescape=True)
        tmpl = env.from_string(
            """
            {{ "<HelloWorld>" }}
            {% autoescape false %}
                {{ "<HelloWorld>" }}
            {% endautoescape %}
            {{ "<HelloWorld>" }}
        """
        )
>       assert tmpl.render().split() == [
            "&lt;HelloWorld&gt;",
            "<HelloWorld>",
            "&lt;HelloWorld&gt;",
        ]

tests/test_ext.py:639: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf71420>
value = '<HelloWorld>'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
_______________________ TestAutoEscape.test_nonvolatile ________________________

self = <test_ext.TestAutoEscape object at 0x7f5c4d35ceb0>

    def test_nonvolatile(self):
        env = Environment(autoescape=True)
        tmpl = env.from_string('{{ {"foo": "<test>"}|xmlattr|escape }}')
        assert tmpl.render() == ' foo="&lt;test&gt;"'
        tmpl = env.from_string(
            '{% autoescape false %}{{ {"foo": "<test>"}'
            "|xmlattr|escape }}{% endautoescape %}"
        )
>       assert tmpl.render() == " foo=&#34;&amp;lt;test&amp;gt;&#34;"
E       assert ' foo="&lt;test&gt;"' == ' foo=&#34;&a...&amp;gt;&#34;'
E         
E         -  foo=&#34;&amp;lt;test&amp;gt;&#34;
E         +  foo="&lt;test&gt;"

tests/test_ext.py:669: AssertionError
_________________________ TestAutoEscape.test_volatile _________________________

self = <test_ext.TestAutoEscape object at 0x7f5c4d35c940>

    def test_volatile(self):
        env = Environment(autoescape=True)
        tmpl = env.from_string(
            '{% autoescape foo %}{{ {"foo": "<test>"}'
            "|xmlattr|escape }}{% endautoescape %}"
        )
>       assert tmpl.render(foo=False) == " foo=&#34;&amp;lt;test&amp;gt;&#34;"
E       assert ' foo="&lt;test&gt;"' == ' foo=&#34;&a...&amp;gt;&#34;'
E         
E         -  foo=&#34;&amp;lt;test&amp;gt;&#34;
E         +  foo="&lt;test&gt;"

tests/test_ext.py:677: AssertionError
_________________________ TestAutoEscape.test_scoping __________________________

self = <test_ext.TestAutoEscape object at 0x7f5c4d32beb0>

    def test_scoping(self):
        env = Environment()
        tmpl = env.from_string(
            '{% autoescape true %}{% set x = "<x>" %}{{ x }}'
            '{% endautoescape %}{{ x }}{{ "<y>" }}'
        )
>       assert tmpl.render(x=1) == "&lt;x&gt;1<y>"
E       AssertionError: assert '<x>' == '&lt;x&gt;1<y>'
E         
E         - &lt;x&gt;1<y>
E         + <x>

tests/test_ext.py:686: AssertionError
_____________________ TestAutoEscape.test_volatile_scoping _____________________

self = <test_ext.TestAutoEscape object at 0x7f5c4d32ba90>

    def test_volatile_scoping(self):
        env = Environment()
        tmplsource = """
        {% autoescape val %}
            {% macro foo(x) %}
                [{{ x }}]
            {% endmacro %}
            {{ foo().__class__.__name__ }}
        {% endautoescape %}
        {{ '<testing>' }}
        """
        tmpl = env.from_string(tmplsource)
>       assert tmpl.render(val=True).split()[0] == "Markup"
E       AssertionError: assert '[]' == 'Markup'
E         
E         - Markup
E         + []

tests/test_ext.py:700: AssertionError
______________________ TestAutoEscape.test_overlay_scopes ______________________

self = <test_ext.TestAutoEscape object at 0x7f5c4d329990>

    def test_overlay_scopes(self):
        class MagicScopeExtension(Extension):
            tags = {"overlay"}
    
            def parse(self, parser):
                node = nodes.OverlayScope(lineno=next(parser.stream).lineno)
                node.body = list(
                    parser.parse_statements(("name:endoverlay",), drop_needle=True)
                )
                node.context = self.call_method("get_scope")
                return node
    
            def get_scope(self):
                return {"x": [1, 2, 3]}
    
        env = Environment(extensions=[MagicScopeExtension])
    
        tmpl = env.from_string(
            """
            {{- x }}|{% set z = 99 %}
            {%- overlay %}
                {{- y }}|{{ z }}|{% for item in x %}[{{ item }}]{% endfor %}
            {%- endoverlay %}|
            {{- x -}}
        """
        )
>       assert tmpl.render(x=42, y=23) == "42|23|99|[1][2][3]|42"

tests/test_ext.py:739: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ce719f0>
tokens = [('text', '\n            '), ('var', 'x'), ('text', '|'), ('tag', 'set z = 99'), ('text', '\n            '), ('tag', 'overlay'), ...]
pos = 11
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
>                   names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
E                   TypeError: 'int' object is not iterable

src/jinja2/environment.py:963: TypeError
____________________________ TestFilter.test_escape ____________________________

self = <test_filters.TestFilter object at 0x7f5c4d35f250>
env = <jinja2.environment.Environment object at 0x7f5c4ce26590>

    def test_escape(self, env):
        tmpl = env.from_string("""{{ '<">&'|escape }}""")
        out = tmpl.render()
>       assert out == "&lt;&#34;&gt;&amp;"
E       AssertionError: assert '&lt;&quot;&gt;&amp;' == '&lt;&#34;&gt;&amp;'
E         
E         - &lt;&#34;&gt;&amp;
E         ?      ^^^
E         + &lt;&quot;&gt;&amp;
E         ?      ^^^^

tests/test_filters.py:84: AssertionError
__________________________ TestFilter.test_striptags ___________________________

self = <test_filters.TestFilter object at 0x7f5c4d35fbe0>
env = <jinja2.environment.Environment object at 0x7f5c4ce25f30>

    def test_striptags(self, env):
        tmpl = env.from_string("""{{ foo|striptags }}""")
        out = tmpl.render(
            foo='  <p>just a small   \n <a href="#">'
            "example</a> link</p>\n<p>to a webpage</p> "
            "<!-- <p>and some commented stuff</p> -->"
        )
>       assert out == "just a small example link to a webpage"
E       AssertionError: assert 'just a small...ted stuff -->' == 'just a small... to a webpage'
E         
E         - just a small example link to a webpage
E         + just a small example link to a webpage and some commented stuff -->

tests/test_filters.py:101: AssertionError
____________________________ TestFilter.test_indent ____________________________

self = <test_filters.TestFilter object at 0x7f5c4d32b7c0>
env = <jinja2.environment.Environment object at 0x7f5c4cabee90>

    def test_indent(self, env):
>       self._test_indent_multiline_template(env)

tests/test_filters.py:174: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

env = <jinja2.environment.Environment object at 0x7f5c4cabee90>, markup = False

    @staticmethod
    def _test_indent_multiline_template(env, markup=False):
        text = "\n".join(["", "foo bar", '"baz"', ""])
        if markup:
            text = Markup(text)
        t = env.from_string("{{ foo|indent(2, false, false) }}")
>       assert t.render(foo=text) == '\n  foo bar\n  "baz"\n'
E       assert '\n  foo bar\n  "baz"' == '\n  foo bar\n  "baz"\n'
E         
E           
E             foo bar
E         -   "baz"
E         ?        -
E         +   "baz"

tests/test_filters.py:165: AssertionError
_____________________ TestFilter.test_indent_markup_input ______________________

self = <test_filters.TestFilter object at 0x7f5c4d1a0460>
env = <jinja2.environment.Environment object at 0x7f5c4cdc1b70>

    def test_indent_markup_input(self, env):
        """
        Tests cases where the filter input is a Markup type
        """
>       self._test_indent_multiline_template(env, markup=True)

tests/test_filters.py:186: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

env = <jinja2.environment.Environment object at 0x7f5c4cdc1b70>, markup = True

    @staticmethod
    def _test_indent_multiline_template(env, markup=False):
        text = "\n".join(["", "foo bar", '"baz"', ""])
        if markup:
            text = Markup(text)
        t = env.from_string("{{ foo|indent(2, false, false) }}")
>       assert t.render(foo=text) == '\n  foo bar\n  "baz"\n'
E       assert '\n  foo bar\n  "baz"' == '\n  foo bar\n  "baz"\n'
E         
E           
E             foo bar
E         -   "baz"
E         ?        -
E         +   "baz"

tests/test_filters.py:165: AssertionError
_____________________ TestFilter.test_indent_width_string ______________________

self = <test_filters.TestFilter object at 0x7f5c4d1a0790>
env = <jinja2.environment.Environment object at 0x7f5c4cabf580>

    def test_indent_width_string(self, env):
        t = env.from_string("{{ 'jinja\nflask'|indent(width='>>> ', first=True) }}")
>       assert t.render() == ">>> jinja\n>>> flask"

tests/test_filters.py:190: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = "'jinja\nflask'"
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cabf580>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           'jinja
E           ^
E       SyntaxError: unterminated string literal (detected at line 1)

src/jinja2/environment.py:915: SyntaxError
_____________________________ TestFilter.test_join _____________________________

self = <test_filters.TestFilter object at 0x7f5c4d35e140>
env = <jinja2.environment.Environment object at 0x7f5c4cacbe50>

    def test_join(self, env):
        tmpl = env.from_string('{{ [1, 2, 3]|join("|") }}')
        out = tmpl.render()
        assert out == "1|2|3"
    
        env2 = Environment(autoescape=True)
        tmpl = env2.from_string('{{ ["<foo>", "<span>foo</span>"|safe]|join }}')
>       assert tmpl.render() == "&lt;foo&gt;<span>foo</span>"

tests/test_filters.py:232: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
____________________________ TestFilter.test_title _____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1a2d70>
env = <jinja2.environment.Environment object at 0x7f5c4ce49b70>

    def test_title(self, env):
        tmpl = env.from_string("""{{ "foo bar"|title }}""")
        assert tmpl.render() == "Foo Bar"
        tmpl = env.from_string("""{{ "foo's bar"|title }}""")
>       assert tmpl.render() == "Foo's Bar"
E       assert "Foo'S Bar" == "Foo's Bar"
E         
E         - Foo's Bar
E         ?     ^
E         + Foo'S Bar
E         ?     ^

tests/test_filters.py:303: AssertionError
____________________________ TestFilter.test_urlize ____________________________

self = <test_filters.TestFilter object at 0x7f5c4d35dff0>
env = <jinja2.environment.Environment object at 0x7f5c4cac8cd0>

    def test_urlize(self, env):
        tmpl = env.from_string('{{ "foo example.org bar"|urlize }}')
        assert tmpl.render() == (
            'foo <a href="https://example.org" rel="noopener">' "example.org</a> bar"
        )
        tmpl = env.from_string('{{ "foo http://www.example.com/ bar"|urlize }}')
        assert tmpl.render() == (
            'foo <a href="http://www.example.com/" rel="noopener">'
            "http://www.example.com/</a> bar"
        )
        tmpl = env.from_string('{{ "foo mailto:email@example.com bar"|urlize }}')
>       assert tmpl.render() == (
            'foo <a href="mailto:email@example.com">email@example.com</a> bar'
        )
E       assert 'foo <a href=...e.com</a> bar' == 'foo <a href=...e.com</a> bar'
E         
E         - foo <a href="mailto:email@example.com">email@example.com</a> bar
E         + foo <a href="mailto:mailto:email@example.com" rel="noopener">mailto:email@example.com</a> bar
E         ?              +++++++                         +++++++++++++++ +++++++

tests/test_filters.py:367: AssertionError
____________________________ TestFilter.test_block _____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1a2650>
env = <jinja2.environment.Environment object at 0x7f5c4ce48b80>

    def test_block(self, env):
        tmpl = env.from_string("{% filter lower|escape %}<HEHE>{% endfilter %}")
>       assert tmpl.render() == "&lt;hehe&gt;"
E       AssertionError: assert '<HEHE>' == '&lt;hehe&gt;'
E         
E         - &lt;hehe&gt;
E         + <HEHE>

tests/test_filters.py:415: AssertionError
____________________________ TestFilter.test_sort2 _____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1a3310>
env = <jinja2.environment.Environment object at 0x7f5c4caca5f0>

    def test_sort2(self, env):
        tmpl = env.from_string('{{ "".join(["c", "A", "b", "D"]|sort) }}')
>       assert tmpl.render() == "AbcD"

tests/test_filters.py:490: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'list' and 'Undefined'

<string>:1: TypeError
____________________________ TestFilter.test_unique ____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c5690>
env = <jinja2.environment.Environment object at 0x7f5c4cf252d0>

    def test_unique(self, env):
        t = env.from_string('{{ "".join(["b", "A", "a", "b"]|unique) }}')
>       assert t.render() == "bA"

tests/test_filters.py:542: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'list' and 'Undefined'

<string>:1: TypeError
____________________ TestFilter.test_unique_case_sensitive _____________________

self = <test_filters.TestFilter object at 0x7f5c4d1c59c0>
env = <jinja2.environment.Environment object at 0x7f5c4d1a2b00>

    def test_unique_case_sensitive(self, env):
        t = env.from_string('{{ "".join(["b", "A", "a", "b"]|unique(true)) }}')
>       assert t.render() == "bAa"

tests/test_filters.py:546: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (True,), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'unique' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________________ TestFilter.test_groupby ____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c5cc0>
env = <jinja2.environment.Environment object at 0x7f5c4ce48ac0>

    def test_groupby(self, env):
        tmpl = env.from_string(
            """
        {%- for grouper, list in [{'foo': 1, 'bar': 2},
                                  {'foo': 2, 'bar': 3},
                                  {'foo': 1, 'bar': 1},
                                  {'foo': 3, 'bar': 4}]|groupby('foo') -%}
            {{ grouper }}{% for x in list %}: {{ x.foo }}, {{ x.bar }}{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render().split("|") == ["1: 1, 2: 1, 1", "2: 2, 3", "3: 3, 4", ""]

tests/test_filters.py:582: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
_____________________ TestFilter.test_groupby_tuple_index ______________________

self = <test_filters.TestFilter object at 0x7f5c4d1c5510>
env = <jinja2.environment.Environment object at 0x7f5c4d35f550>

    def test_groupby_tuple_index(self, env):
        tmpl = env.from_string(
            """
        {%- for grouper, list in [('a', 1), ('a', 2), ('b', 1)]|groupby(0) -%}
            {{ grouper }}{% for x in list %}:{{ x.1 }}{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render() == "a:1:2|b:1|"

tests/test_filters.py:591: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'x.1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4d35f550>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           x.1
E            ^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_______________________ TestFilter.test_groupby_multidot _______________________

self = <test_filters.TestFilter object at 0x7f5c4d1c4880>
env = <jinja2.environment.Environment object at 0x7f5c4ce738e0>

    def test_groupby_multidot(self, env):
        Date = namedtuple("Date", "day,month,year")
        Article = namedtuple("Article", "title,date")
        articles = [
            Article("aha", Date(1, 1, 1970)),
            Article("interesting", Date(2, 1, 1970)),
            Article("really?", Date(3, 1, 1970)),
            Article("totally not", Date(1, 1, 1971)),
        ]
        tmpl = env.from_string(
            """
        {%- for year, list in articles|groupby('date.year') -%}
            {{ year }}{% for x in list %}[{{ x.title }}]{% endfor %}|
        {%- endfor %}"""
        )
>       assert tmpl.render(articles=articles).split("|") == [
            "1970[aha][interesting][really?]",
            "1971[totally not]",
            "",
        ]

tests/test_filters.py:608: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ TestFilter.test_groupby_default ________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c4820>
env = <jinja2.environment.Environment object at 0x7f5c4cf60f40>

    def test_groupby_default(self, env):
        tmpl = env.from_string(
            "{% for city, items in users|groupby('city', default='NY') %}"
            "{{ city }}: {{ items|map(attribute='name')|join(', ') }}\n"
            "{% endfor %}"
        )
        out = tmpl.render(
            users=[
                {"name": "emma", "city": "NY"},
                {"name": "smith", "city": "WA"},
                {"name": "john"},
            ]
        )
>       assert out == "NY: emma, john\nWA: smith\n"
E       AssertionError: assert 'ny: emma, john\nwa: smith' == 'NY: emma, john\nWA: smith\n'
E         
E         - NY: emma, john
E         ? ^^
E         + ny: emma, john
E         ? ^^
E         - WA: smith
E         + wa: smith

tests/test_filters.py:627: AssertionError
_____________ TestFilter.test_groupby_case[False-a: 1, 3\nb: 2\n] ______________

self = <test_filters.TestFilter object at 0x7f5c4d1c6620>
env = <jinja2.environment.Environment object at 0x7f5c4d32a860>
case_sensitive = False, expect = 'a: 1, 3\nb: 2\n'

    @pytest.mark.parametrize(
        ("case_sensitive", "expect"),
        [
            (False, "a: 1, 3\nb: 2\n"),
            (True, "A: 3\na: 1\nb: 2\n"),
        ],
    )
    def test_groupby_case(self, env, case_sensitive, expect):
        tmpl = env.from_string(
            "{% for k, vs in data|groupby('k', case_sensitive=cs) %}"
            "{{ k }}: {{ vs|join(', ', attribute='v') }}\n"
            "{% endfor %}"
        )
        out = tmpl.render(
            data=[{"k": "a", "v": 1}, {"k": "b", "v": 2}, {"k": "A", "v": 3}],
            cs=case_sensitive,
        )
>       assert out == expect
E       AssertionError: assert 'a: 1, 3\nb: 2' == 'a: 1, 3\nb: 2\n'
E         
E           a: 1, 3
E         - b: 2
E         ?     -
E         + b: 2

tests/test_filters.py:646: AssertionError
____________ TestFilter.test_groupby_case[True-A: 3\na: 1\nb: 2\n] _____________

self = <test_filters.TestFilter object at 0x7f5c4d1c6770>
env = <jinja2.environment.Environment object at 0x7f5c4d05f100>
case_sensitive = True, expect = 'A: 3\na: 1\nb: 2\n'

    @pytest.mark.parametrize(
        ("case_sensitive", "expect"),
        [
            (False, "a: 1, 3\nb: 2\n"),
            (True, "A: 3\na: 1\nb: 2\n"),
        ],
    )
    def test_groupby_case(self, env, case_sensitive, expect):
        tmpl = env.from_string(
            "{% for k, vs in data|groupby('k', case_sensitive=cs) %}"
            "{{ k }}: {{ vs|join(', ', attribute='v') }}\n"
            "{% endfor %}"
        )
        out = tmpl.render(
            data=[{"k": "a", "v": 1}, {"k": "b", "v": 2}, {"k": "A", "v": 3}],
            cs=case_sensitive,
        )
>       assert out == expect
E       AssertionError: assert 'A: 3\na: 1\nb: 2' == 'A: 3\na: 1\nb: 2\n'
E         
E           A: 3
E           a: 1
E         - b: 2
E         ?     -
E         + b: 2

tests/test_filters.py:646: AssertionError
__________________________ TestFilter.test_filtertag ___________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c6ad0>
env = <jinja2.environment.Environment object at 0x7f5c4cf26c50>

    def test_filtertag(self, env):
        tmpl = env.from_string(
            "{% filter upper|replace('FOO', 'foo') %}foobar{% endfilter %}"
        )
>       assert tmpl.render() == "fooBAR"
E       AssertionError: assert 'foobar' == 'fooBAR'
E         
E         - fooBAR
E         + foobar

tests/test_filters.py:652: AssertionError
___________________________ TestFilter.test_replace ____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c6dd0>
env = <jinja2.environment.Environment object at 0x7f5c4ce25ab0>

    def test_replace(self, env):
        env = Environment()
        tmpl = env.from_string('{{ string|replace("o", 42) }}')
        assert tmpl.render(string="<foo>") == "<f4242>"
        env = Environment(autoescape=True)
        tmpl = env.from_string('{{ string|replace("o", 42) }}')
>       assert tmpl.render(string="<foo>") == "&lt;f4242&gt;"

tests/test_filters.py:660: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ce25ab0>
value = '<f4242>'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
_________________________ TestFilter.test_forceescape __________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7100>
env = <jinja2.environment.Environment object at 0x7f5c4cf5c430>

    def test_forceescape(self, env):
        tmpl = env.from_string("{{ x|forceescape }}")
>       assert tmpl.render(x=Markup("<div />")) == "&lt;div /&gt;"
E       AssertionError: assert '<div />' == '&lt;div /&gt;'
E         
E         - &lt;div /&gt;
E         + <div />

tests/test_filters.py:668: AssertionError
_____________________________ TestFilter.test_safe _____________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7430>
env = <jinja2.environment.Environment object at 0x7f5c4ce7d000>

    def test_safe(self, env):
        env = Environment(autoescape=True)
        tmpl = env.from_string('{{ "<div>foo</div>"|safe }}')
        assert tmpl.render() == "<div>foo</div>"
        tmpl = env.from_string('{{ "<div>foo</div>" }}')
>       assert tmpl.render() == "&lt;div&gt;foo&lt;/div&gt;"

tests/test_filters.py:675: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ce7d000>
value = '<div>foo</div>'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
_________ TestFilter.test_urlencode[Hello, world!-Hello%2C%20world%21] _________

self = <test_filters.TestFilter object at 0x7f5c4d1a3070>
value = 'Hello, world!', expect = 'Hello%2C%20world%21'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ce49fc0>
value = 'Hello%2C%20world%21'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
___ TestFilter.test_urlencode[Hello, world\u203d-Hello%2C%20world%E2%80%BD] ____

self = <test_filters.TestFilter object at 0x7f5c4d1a1e10>
value = 'Hello, world‽', expect = 'Hello%2C%20world%E2%80%BD'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d0423b0>
value = 'Hello%2C%20world%E2%80%BD'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
____________________ TestFilter.test_urlencode[value2-f=1] _____________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7880>, value = {'f': 1}
expect = 'f=1'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cdc0250>, value = 'f=1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
________________ TestFilter.test_urlencode[value3-f=1&amp;z=2] _________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7b80>
value = [('f', 1), ('z', 2)], expect = 'f=1&amp;z=2'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf59840>
value = 'f=1&z=2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
________________ TestFilter.test_urlencode[value4-%E2%80%BD=1] _________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7580>, value = {'‽': 1}
expect = '%E2%80%BD=1'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cabfc40>
value = '%E2%80%BD=1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
____________________ TestFilter.test_urlencode[value5-0=1] _____________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7670>, value = {0: 1}
expect = '0=1'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d059ed0>, value = '0=1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
______________ TestFilter.test_urlencode[value6-a+b%2Fc=a+b%2Fc] _______________

self = <test_filters.TestFilter object at 0x7f5c4d1c7130>
value = [('a b/c', 'a b/c')], expect = 'a+b%2Fc=a+b%2Fc'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf5c6d0>
value = 'a+b%2Fc=a+b%2Fc'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
___________________ TestFilter.test_urlencode[a b/c-a%20b/c] ___________________

self = <test_filters.TestFilter object at 0x7f5c4d1c7370>, value = 'a b/c'
expect = 'a%20b/c'

    @pytest.mark.parametrize(
        ("value", "expect"),
        [
            ("Hello, world!", "Hello%2C%20world%21"),
            ("Hello, world\u203d", "Hello%2C%20world%E2%80%BD"),
            ({"f": 1}, "f=1"),
            ([("f", 1), ("z", 2)], "f=1&amp;z=2"),
            ({"\u203d": 1}, "%E2%80%BD=1"),
            ({0: 1}, "0=1"),
            ([("a b/c", "a b/c")], "a+b%2Fc=a+b%2Fc"),
            ("a b/c", "a%20b/c"),
        ],
    )
    def test_urlencode(self, value, expect):
        e = Environment(autoescape=True)
        t = e.from_string("{{ value|urlencode }}")
>       assert t.render(value=value) == expect

tests/test_filters.py:693: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d35cf70>
value = 'a%20b/c'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
__________________________ TestFilter.test_empty_map ___________________________

self = <test_filters.TestFilter object at 0x7f5c4d1c5840>
env = <jinja2.environment.Environment object at 0x7f5c4cabda50>

    def test_empty_map(self, env):
        env = Environment()
        tmpl = env.from_string('{{ none|map("upper")|list }}')
>       assert tmpl.render() == "[]"

tests/test_filters.py:718: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
src/jinja2/environment.py:1024: in _env_filter_test_fixed
    return func(*call_args, **kwargs)
src/jinja2/filters.py:1067: in sync_do_list
    def sync_do_list(value): return list(value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...jinja2.utils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>} of None>
value = None, args = ('upper',), kwargs = {}
func = <function sync_do_map.<locals>.<lambda> at 0x7f5c4cb06830>

    @pass_context
    def sync_do_map(context,value,*args,**kwargs):
        if not args and 'attribute' in kwargs:
            func=make_attrgetter(context.environment, kwargs.pop('attribute'), default=kwargs.pop('default', None))
        else:
            name=args[0]; fargs=args[1:]; func=lambda x: context.environment.call_filter(name,x,fargs,kwargs,context=context)
>       for item in value: yield func(item)
E       TypeError: 'NoneType' object is not iterable

src/jinja2/filters.py:1085: TypeError
_______________________ TestFilter.test_filter_undefined _______________________

self = <test_filters.TestFilter object at 0x7f5c4d1c6920>
env = <jinja2.environment.Environment object at 0x7f5c4d1a0130>

    def test_filter_undefined(self, env):
>       with pytest.raises(TemplateAssertionError, match="No filter named 'f'"):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateAssertionError'>

tests/test_filters.py:837: Failed
____________________ TestFilter.test_filter_undefined_in_if ____________________

self = <test_filters.TestFilter object at 0x7f5c4d1c6cb0>
env = <jinja2.environment.Environment object at 0x7f5c4d1a19c0>

    def test_filter_undefined_in_if(self, env):
        t = env.from_string("{%- if x is defined -%}{{ x|f }}{%- else -%}x{% endif %}")
>       assert t.render() == "x"

tests/test_filters.py:842: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:955: in _render_tokens
    body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d1a19c0>
mapping = {'abs': <built-in function abs>, 'attr': <function do_attr at 0x7f5c4d53f6d0>, 'batch': <function do_batch at 0x7f5c4d53ee60>, 'capitalize': <function do_capitalize at 0x7f5c4d53dfc0>, ...}
name = 'f', value = Undefined, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...jinja2.utils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'f'

src/jinja2/environment.py:1019: KeyError
___________________ TestFilter.test_filter_undefined_in_elif ___________________

self = <test_filters.TestFilter object at 0x7f5c4d1ed0c0>
env = <jinja2.environment.Environment object at 0x7f5c4cabe1d0>

    def test_filter_undefined_in_elif(self, env):
        t = env.from_string(
            "{%- if x is defined -%}{{ x }}{%- elif y is defined -%}"
            "{{ y|f }}{%- else -%}foo{%- endif -%}"
        )
>       assert t.render() == "foo"
E       AssertionError: assert '' == 'foo'
E         
E         - foo

tests/test_filters.py:851: AssertionError
___________________ TestFilter.test_filter_undefined_in_else ___________________

self = <test_filters.TestFilter object at 0x7f5c4d1ec9d0>
env = <jinja2.environment.Environment object at 0x7f5c4cf24ee0>

    def test_filter_undefined_in_else(self, env):
        t = env.from_string(
            "{%- if x is not defined -%}foo{%- else -%}{{ x|f }}{%- endif -%}"
        )
        assert t.render() == "foo"
        with pytest.raises(TemplateRuntimeError, match="No filter named 'f'"):
>           t.render(x=42)

tests/test_filters.py:861: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:957: in _render_tokens
    elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf24ee0>
mapping = {'abs': <built-in function abs>, 'attr': <function do_attr at 0x7f5c4d53f6d0>, 'batch': <function do_batch at 0x7f5c4d53ee60>, 'capitalize': <function do_capitalize at 0x7f5c4d53dfc0>, ...}
name = 'f', value = 42, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...ils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'x': 42} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'f'

src/jinja2/environment.py:1019: KeyError
________________ TestFilter.test_filter_undefined_in_nested_if _________________

self = <test_filters.TestFilter object at 0x7f5c4d1ec880>
env = <jinja2.environment.Environment object at 0x7f5c4cf210c0>

    def test_filter_undefined_in_nested_if(self, env):
        t = env.from_string(
            "{%- if x is not defined -%}foo{%- else -%}{%- if y "
            "is defined -%}{{ y|f }}{%- endif -%}{{ x }}{%- endif -%}"
        )
        assert t.render() == "foo"
>       assert t.render(x=42) == "42"

tests/test_filters.py:869: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:957: in _render_tokens
    elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
src/jinja2/environment.py:955: in _render_tokens
    body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cf210c0>
mapping = {'abs': <built-in function abs>, 'attr': <function do_attr at 0x7f5c4d53f6d0>, 'batch': <function do_batch at 0x7f5c4d53ee60>, 'capitalize': <function do_capitalize at 0x7f5c4d53dfc0>, ...}
name = 'f', value = Undefined, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...ils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'x': 42} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'f'

src/jinja2/environment.py:1019: KeyError
_________________ TestFilter.test_filter_undefined_in_condexpr _________________

self = <test_filters.TestFilter object at 0x7f5c4d1ec160>
env = <jinja2.environment.Environment object at 0x7f5c4d05f070>

    def test_filter_undefined_in_condexpr(self, env):
        t1 = env.from_string("{{ x|f if x is defined else 'foo' }}")
        t2 = env.from_string("{{ 'foo' if x is not defined else x|f }}")
        assert t1.render() == t2.render() == "foo"
    
        with pytest.raises(TemplateRuntimeError, match="No filter named 'f'"):
>           t1.render(x=42)

tests/test_filters.py:879: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:904: in _eval_expr
    if m: return _eval_expr(m.group(1),ctx,env) if _eval_expr(m.group(2),ctx,env) else _eval_expr(m.group(3),ctx,env)
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d05f070>
mapping = {'abs': <built-in function abs>, 'attr': <function do_attr at 0x7f5c4d53f6d0>, 'batch': <function do_batch at 0x7f5c4d53ee60>, 'capitalize': <function do_capitalize at 0x7f5c4d53dfc0>, ...}
name = 'f', value = 42, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...ils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'x': 42} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'f'

src/jinja2/environment.py:1019: KeyError
_________________________________ test_basics __________________________________

    def test_basics():
        for_loop = nodes.For(
            nodes.Name("foo", "store"),
            nodes.Name("seq", "load"),
            [nodes.Output([nodes.Name("foo", "load")])],
            [],
            None,
            False,
        )
        tmpl = nodes.Template(
            [nodes.Assign(nodes.Name("foo", "store"), nodes.Name("bar", "load")), for_loop]
        )
    
        sym = symbols_for_node(tmpl)
        assert sym.refs == {
            "foo": "l_0_foo",
            "bar": "l_0_bar",
            "seq": "l_0_seq",
        }
>       assert sym.loads == {
            "l_0_foo": ("undefined", None),
            "l_0_bar": ("resolve", "bar"),
            "l_0_seq": ("resolve", "seq"),
        }
E       AssertionError: assert {'l_0_bar': '...q': 'resolve'} == {'l_0_bar': (...olve', 'seq')}
E         
E         Differing items:
E         {'l_0_bar': 'resolve'} != {'l_0_bar': ('resolve', 'bar')}
E         {'l_0_seq': 'resolve'} != {'l_0_seq': ('resolve', 'seq')}
E         Right contains 1 more item:
E         {'l_0_foo': ('undefined', None)}
E         Use -v to get more diff

tests/test_idtracking.py:24: AssertionError
_________________________________ test_complex _________________________________

    def test_complex():
        title_block = nodes.Block(
            "title", [nodes.Output([nodes.TemplateData("Page Title")])], False, False
        )
    
        render_title_macro = nodes.Macro(
            "render_title",
            [nodes.Name("title", "param")],
            [],
            [
                nodes.Output(
                    [
                        nodes.TemplateData('\n  <div class="title">\n    <h1>'),
                        nodes.Name("title", "load"),
                        nodes.TemplateData("</h1>\n    <p>"),
                        nodes.Name("subtitle", "load"),
                        nodes.TemplateData("</p>\n    "),
                    ]
                ),
                nodes.Assign(
                    nodes.Name("subtitle", "store"), nodes.Const("something else")
                ),
                nodes.Output(
                    [
                        nodes.TemplateData("\n    <p>"),
                        nodes.Name("subtitle", "load"),
                        nodes.TemplateData("</p>\n  </div>\n"),
                        nodes.If(
                            nodes.Name("something", "load"),
                            [
                                nodes.Assign(
                                    nodes.Name("title_upper", "store"),
                                    nodes.Filter(
                                        nodes.Name("title", "load"),
                                        "upper",
                                        [],
                                        [],
                                        None,
                                        None,
                                    ),
                                ),
                                nodes.Output(
                                    [
                                        nodes.Name("title_upper", "load"),
                                        nodes.Call(
                                            nodes.Name("render_title", "load"),
                                            [nodes.Const("Aha")],
                                            [],
                                            None,
                                            None,
                                        ),
                                    ]
                                ),
                            ],
                            [],
                            [],
                        ),
                    ]
                ),
            ],
        )
    
        for_loop = nodes.For(
            nodes.Name("item", "store"),
            nodes.Name("seq", "load"),
            [
                nodes.Output(
                    [
                        nodes.TemplateData("\n    <li>"),
                        nodes.Name("item", "load"),
                        nodes.TemplateData("</li>\n    <span>"),
                    ]
                ),
                nodes.Include(nodes.Const("helper.html"), True, False),
                nodes.Output([nodes.TemplateData("</span>\n  ")]),
            ],
            [],
            None,
            False,
        )
    
        body_block = nodes.Block(
            "body",
            [
                nodes.Output(
                    [
                        nodes.TemplateData("\n  "),
                        nodes.Call(
                            nodes.Name("render_title", "load"),
                            [nodes.Name("item", "load")],
                            [],
                            None,
                            None,
                        ),
                        nodes.TemplateData("\n  <ul>\n  "),
                    ]
                ),
                for_loop,
                nodes.Output([nodes.TemplateData("\n  </ul>\n")]),
            ],
            False,
            False,
        )
    
        tmpl = nodes.Template(
            [
                nodes.Extends(nodes.Const("layout.html")),
                title_block,
                render_title_macro,
                body_block,
            ]
        )
    
        tmpl_sym = symbols_for_node(tmpl)
>       assert tmpl_sym.refs == {
            "render_title": "l_0_render_title",
        }
E       AssertionError: assert {'render_titl...0_title', ...} == {'render_titl...render_title'}
E         
E         Omitting 1 identical items, use -vv to show
E         Left contains 4 more items:
E         {'something': 'l_0_something',
E          'subtitle': 'l_0_subtitle',
E          'title': 'l_0_title',
E          'title_upper': 'l_0_title_upper'}
E         Use -v to get more diff

tests/test_idtracking.py:153: AssertionError
___________________________ test_if_branching_stores ___________________________

    def test_if_branching_stores():
        tmpl = nodes.Template(
            [
                nodes.If(
                    nodes.Name("expression", "load"),
                    [nodes.Assign(nodes.Name("variable", "store"), nodes.Const(42))],
                    [],
                    [],
                )
            ]
        )
    
        sym = symbols_for_node(tmpl)
        assert sym.refs == {"variable": "l_0_variable", "expression": "l_0_expression"}
        assert sym.stores == {"variable"}
>       assert sym.loads == {
            "l_0_variable": ("resolve", "variable"),
            "l_0_expression": ("resolve", "expression"),
        }
E       AssertionError: assert {'l_0_expression': 'resolve'} == {'l_0_express..., 'variable')}
E         
E         Differing items:
E         {'l_0_expression': 'resolve'} != {'l_0_expression': ('resolve', 'expression')}
E         Right contains 1 more item:
E         {'l_0_variable': ('resolve', 'variable')}
E         Use -v to get more diff

tests/test_idtracking.py:227: AssertionError
______________________ test_if_branching_stores_undefined ______________________

    def test_if_branching_stores_undefined():
        tmpl = nodes.Template(
            [
                nodes.Assign(nodes.Name("variable", "store"), nodes.Const(23)),
                nodes.If(
                    nodes.Name("expression", "load"),
                    [nodes.Assign(nodes.Name("variable", "store"), nodes.Const(42))],
                    [],
                    [],
                ),
            ]
        )
    
        sym = symbols_for_node(tmpl)
        assert sym.refs == {"variable": "l_0_variable", "expression": "l_0_expression"}
        assert sym.stores == {"variable"}
>       assert sym.loads == {
            "l_0_variable": ("undefined", None),
            "l_0_expression": ("resolve", "expression"),
        }
E       AssertionError: assert {'l_0_expression': 'resolve'} == {'l_0_express...fined', None)}
E         
E         Differing items:
E         {'l_0_expression': 'resolve'} != {'l_0_expression': ('resolve', 'expression')}
E         Right contains 1 more item:
E         {'l_0_variable': ('undefined', None)}
E         Use -v to get more diff

tests/test_idtracking.py:252: AssertionError
________________________ test_if_branching_multi_scope _________________________

    def test_if_branching_multi_scope():
        for_loop = nodes.For(
            nodes.Name("item", "store"),
            nodes.Name("seq", "load"),
            [
                nodes.If(
                    nodes.Name("expression", "load"),
                    [nodes.Assign(nodes.Name("x", "store"), nodes.Const(42))],
                    [],
                    [],
                ),
                nodes.Include(nodes.Const("helper.html"), True, False),
            ],
            [],
            None,
            False,
        )
    
        tmpl = nodes.Template(
            [nodes.Assign(nodes.Name("x", "store"), nodes.Const(23)), for_loop]
        )
    
        tmpl_sym = symbols_for_node(tmpl)
        for_sym = symbols_for_node(for_loop, tmpl_sym)
>       assert for_sym.stores == {"item", "x"}
E       AssertionError: assert {'item'} == {'item', 'x'}
E         
E         Extra items in the right set:
E         'x'
E         Use -v to get more diff

tests/test_idtracking.py:285: AssertionError
_______________________ TestImports.test_context_imports _______________________

self = <test_imports.TestImports object at 0x7f5c4d1ee950>
test_env = <jinja2.environment.Environment object at 0x7f5c4cf54400>

    def test_context_imports(self, test_env):
        t = test_env.from_string('{% import "module" as m %}{{ m.test() }}')
>       assert t.render(foo=42) == "[|23]"

tests/test_imports.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'm' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestImports.test_import_needs_name ______________________

self = <test_imports.TestImports object at 0x7f5c4d1eec20>
test_env = <jinja2.environment.Environment object at 0x7f5c4cabe8c0>

    def test_import_needs_name(self, test_env):
        test_env.from_string('{% from "foo" import bar %}')
        test_env.from_string('{% from "foo" import bar, baz %}')
    
>       with pytest.raises(TemplateSyntaxError):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_imports.py:53: Failed
______________________ TestImports.test_no_trailing_comma ______________________

self = <test_imports.TestImports object at 0x7f5c4d1eeef0>
test_env = <jinja2.environment.Environment object at 0x7f5c4d04cc10>

    def test_no_trailing_comma(self, test_env):
>       with pytest.raises(TemplateSyntaxError):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_imports.py:57: Failed
_________________ TestImports.test_trailing_comma_with_context _________________

self = <test_imports.TestImports object at 0x7f5c4d1ef220>
test_env = <jinja2.environment.Environment object at 0x7f5c4cabc310>

    def test_trailing_comma_with_context(self, test_env):
        test_env.from_string('{% from "foo" import bar, baz with context %}')
        test_env.from_string('{% from "foo" import bar, baz, with context %}')
        test_env.from_string('{% from "foo" import bar, with context %}')
        test_env.from_string('{% from "foo" import bar, with, context %}')
        test_env.from_string('{% from "foo" import bar, with with context %}')
    
>       with pytest.raises(TemplateSyntaxError):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_imports.py:73: Failed
___________________________ TestImports.test_exports ___________________________

self = <test_imports.TestImports object at 0x7f5c4d1ef550>
test_env = <jinja2.environment.Environment object at 0x7f5c4ca4cb80>

    def test_exports(self, test_env):
        m = test_env.from_string(
            """
            {% macro toplevel() %}...{% endmacro %}
            {% macro __private() %}...{% endmacro %}
            {% set variable = 42 %}
            {% for item in [1] %}
                {% macro notthere() %}{% endmacro %}
            {% endfor %}
        """
        ).module
>       assert m.toplevel() == "..."
E       AttributeError: 'NoneType' object has no attribute 'toplevel'

tests/test_imports.py:90: AttributeError
________________________ TestImports.test_not_exported _________________________

self = <test_imports.TestImports object at 0x7f5c4d1ef880>
test_env = <jinja2.environment.Environment object at 0x7f5c4cabd720>

    def test_not_exported(self, test_env):
        t = test_env.from_string("{% from 'module' import nothing %}{{ nothing() }}")
    
        with pytest.raises(UndefinedError, match="does not export the requested name"):
>           t.render()

tests/test_imports.py:99: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'nothing' is undefined

src/jinja2/runtime.py:551: UndefinedError

During handling of the above exception, another exception occurred:

self = <test_imports.TestImports object at 0x7f5c4d1ef880>
test_env = <jinja2.environment.Environment object at 0x7f5c4cabd720>

    def test_not_exported(self, test_env):
        t = test_env.from_string("{% from 'module' import nothing %}{{ nothing() }}")
    
>       with pytest.raises(UndefinedError, match="does not export the requested name"):
E       AssertionError: Regex pattern did not match.
E         Expected regex: 'does not export the requested name'
E         Actual message: "'nothing' is undefined"

tests/test_imports.py:98: AssertionError
_____________________ TestImports.test_import_with_globals _____________________

self = <test_imports.TestImports object at 0x7f5c4d1efbb0>
test_env = <jinja2.environment.Environment object at 0x7f5c4ce25570>

    def test_import_with_globals(self, test_env):
        t = test_env.from_string(
            '{% import "module" as m %}{{ m.test() }}', globals={"foo": 42}
        )
>       assert t.render() == "[42|23]"

tests/test_imports.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'm' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________ TestImports.test_import_with_globals_override _________________

self = <test_imports.TestImports object at 0x7f5c4d1c59f0>
test_env = <jinja2.environment.Environment object at 0x7f5c4d04ee00>

    def test_import_with_globals_override(self, test_env):
        t = test_env.from_string(
            '{% set foo = 41 %}{% import "module" as m %}{{ m.test() }}',
            globals={"foo": 42},
        )
>       assert t.render() == "[42|23]"

tests/test_imports.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'm' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________ TestImports.test_from_import_with_globals ___________________

self = <test_imports.TestImports object at 0x7f5c4d1c7010>
test_env = <jinja2.environment.Environment object at 0x7f5c4ca6a0b0>

    def test_from_import_with_globals(self, test_env):
        t = test_env.from_string(
            '{% from "module" import test %}{{ test() }}',
            globals={"foo": 42},
        )
>       assert t.render() == "[42|23]"

tests/test_imports.py:122: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'test' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestIncludes.test_context_include _______________________

self = <test_imports.TestIncludes object at 0x7f5c4d1ef9a0>
test_env = <jinja2.environment.Environment object at 0x7f5c4d1eea10>

    def test_context_include(self, test_env):
        t = test_env.from_string('{% include "header" %}')
>       assert t.render(foo=42) == "[42|23]"

tests/test_imports.py:128: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d1eea10>
tokens = [('tag', 'include "header"')], pos = 0
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': 42, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
______________________ TestIncludes.test_choice_includes _______________________

self = <test_imports.TestIncludes object at 0x7f5c4d1ef850>
test_env = <jinja2.environment.Environment object at 0x7f5c4ca4fee0>

    def test_choice_includes(self, test_env):
        t = test_env.from_string('{% include ["missing", "header"] %}')
>       assert t.render(foo=42) == "[42|23]"

tests/test_imports.py:136: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ca4fee0>
tokens = [('tag', 'include ["missing", "header"]')], pos = 0
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': 42, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
__________________ TestIncludes.test_include_ignoring_missing __________________

self = <test_imports.TestIncludes object at 0x7f5c4d1ef0d0>
test_env = <jinja2.environment.Environment object at 0x7f5c4cbd5d80>

    def test_include_ignoring_missing(self, test_env):
        t = test_env.from_string('{% include "missing" %}')
>       pytest.raises(TemplateNotFound, t.render)

tests/test_imports.py:166: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cbd5d80>
tokens = [('tag', 'include "missing"')], pos = 0
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
_______________ TestIncludes.test_context_include_with_overrides _______________

self = <test_imports.TestIncludes object at 0x7f5c4d1eeaa0>
test_env = <jinja2.environment.Environment object at 0x7f5c4ce25f30>

    def test_context_include_with_overrides(self, test_env):
        env = Environment(
            loader=DictLoader(
                dict(
                    main="{% for item in [1, 2, 3] %}{% include 'item' %}{% endfor %}",
                    item="{{ item }}",
                )
            )
        )
>       assert env.get_template("main").render() == "123"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_imports.py:182: AttributeError
_____________________ TestIncludes.test_unoptimized_scopes _____________________

self = <test_imports.TestIncludes object at 0x7f5c4d1ee770>
test_env = <jinja2.environment.Environment object at 0x7f5c4d329e70>

    def test_unoptimized_scopes(self, test_env):
        t = test_env.from_string(
            """
            {% macro outer(o) %}
            {% macro inner() %}
            {% include "o_printer" %}
            {% endmacro %}
            {{ inner() }}
            {% endmacro %}
            {{ outer("FOO") }}
        """
        )
>       assert t.render().strip() == "(FOO)"

tests/test_imports.py:196: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d329e70>
tokens = [('text', '\n            '), ('tag', 'macro outer(o)'), ('text', '\n            '), ('tag', 'macro inner()'), ('text', '\n            '), ('tag', 'include "o_printer"'), ...]
pos = 5
ctx = {'bar': 23, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
endtags = ()

    def _render_tokens(self,tokens,pos,ctx,endtags=()):
        out=[]
        while pos<len(tokens):
            typ,val=tokens[pos]
            if typ=='text': out.append(val); pos+=1; continue
            if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
            tag=(val.split(None,1)[0] if val else ''); rest=val[len(tag):].strip()
            if tag in endtags or tag.startswith('end') or tag in ('else','elif'): return ''.join(out),pos,tag
            if tag=='set' and '=' in rest:
                k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
            elif tag=='if':
                body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
                if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
                elif end=='else': body,p,end=self._render_tokens(tokens,p+1,ctx,('endif',)); out.append(body); pos=p+1
                else: pos=self._skip_end(tokens,p,'if')
            elif tag=='for':
                m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
                if end=='else': else_body,p2,end=self._render_tokens(tokens,p+1,ctx,('endfor',)); endpos=p2+1
                if m:
                    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
                    if seq:
                        loop=LoopContext(seq,self.undefined)
                        for item,l in loop:
                            n=ctx.copy(); n['loop']=l
                            if len(names)==1: n[names[0]]=item
                            else:
                                for k,v in zip(names,item): n[k]=v
                            out.append(self._render_tokens(tokens,pos+1,n,('else','endfor'))[0])
                    else: out.append(else_body)
                pos=endpos
>           elif tag=='include': out.append(self.get_template(_eval_expr(rest,ctx,self)).render(ctx)); pos+=1
E           AttributeError: 'NoneType' object has no attribute 'render'

src/jinja2/environment.py:974: AttributeError
__________________ TestIncludes.test_import_from_with_context __________________

self = <test_imports.TestIncludes object at 0x7f5c4d1ec070>

    def test_import_from_with_context(self):
        env = Environment(
            loader=DictLoader({"a": "{% macro x() %}{{ foobar }}{% endmacro %}"})
        )
        t = env.from_string(
            "{% set foobar = 42 %}{% from 'a' import x with context %}{{ x() }}"
        )
>       assert t.render() == "42"

tests/test_imports.py:205: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'x' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ TestInheritance.test_layout __________________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d220760>
env = <jinja2.environment.Environment object at 0x7f5c4cbaf820>

    def test_layout(self, env):
        tmpl = env.get_template("layout")
>       assert tmpl.render() == (
            "|block 1 from layout|block 2 from layout|nested block 4 from layout|"
        )
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:80: AttributeError
_________________________ TestInheritance.test_level1 __________________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d220a00>
env = <jinja2.environment.Environment object at 0x7f5c4cce29e0>

    def test_level1(self, env):
        tmpl = env.get_template("level1")
>       assert tmpl.render() == (
            "|block 1 from level1|block 2 from layout|nested block 4 from layout|"
        )
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:86: AttributeError
_________________________ TestInheritance.test_level2 __________________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d220d00>
env = <jinja2.environment.Environment object at 0x7f5c4d0583a0>

    def test_level2(self, env):
        tmpl = env.get_template("level2")
>       assert tmpl.render() == (
            "|block 1 from level1|nested block 5 from "
            "level2|nested block 4 from layout|"
        )
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:92: AttributeError
_________________________ TestInheritance.test_level3 __________________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d221000>
env = <jinja2.environment.Environment object at 0x7f5c4d1c5a80>

    def test_level3(self, env):
        tmpl = env.get_template("level3")
>       assert tmpl.render() == (
            "|block 1 from level1|block 5 from level3|block 4 from level3|"
        )
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:99: AttributeError
_________________________ TestInheritance.test_level4 __________________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d1ecaf0>
env = <jinja2.environment.Environment object at 0x7f5c4d058850>

    def test_level4(self, env):
        tmpl = env.get_template("level4")
>       assert tmpl.render() == (
            "|block 1 from level1|block 5 from level3|block 3 from level4|"
        )
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:105: AttributeError
__________________________ TestInheritance.test_super __________________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d1eed70>
env = <jinja2.environment.Environment object at 0x7f5c4ce27160>

    def test_super(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "a": "{% block intro %}INTRO{% endblock %}|"
                    "BEFORE|{% block data %}INNER{% endblock %}|AFTER",
                    "b": '{% extends "a" %}{% block data %}({{ '
                    "super() }}){% endblock %}",
                    "c": '{% extends "b" %}{% block intro %}--{{ '
                    "super() }}--{% endblock %}\n{% block data "
                    "%}[{{ super() }}]{% endblock %}",
                }
            )
        )
        tmpl = env.get_template("c")
>       assert tmpl.render() == "--INTRO--|BEFORE|[(INNER)]|AFTER"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:124: AttributeError
______________________ TestInheritance.test_reuse_blocks _______________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d1efdc0>
env = <jinja2.environment.Environment object at 0x7f5c4ce4c100>

    def test_reuse_blocks(self, env):
        tmpl = env.from_string(
            "{{ self.foo() }}|{% block foo %}42{% endblock %}|{{ self.foo() }}"
        )
>       assert tmpl.render() == "42|42|42"

tests/test_inheritance.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'self' is undefined

src/jinja2/runtime.py:551: UndefinedError
_____________________ TestInheritance.test_preserve_blocks _____________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d1c6f20>
env = <jinja2.environment.Environment object at 0x7f5c4cf25540>

    def test_preserve_blocks(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "a": "{% if false %}{% block x %}A{% endblock %}"
                    "{% endif %}{{ self.x() }}",
                    "b": '{% extends "a" %}{% block x %}B{{ super() }}{% endblock %}',
                }
            )
        )
        tmpl = env.get_template("b")
>       assert tmpl.render() == "BA"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:146: AttributeError
___________________ TestInheritance.test_dynamic_inheritance ___________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d1a0190>
env = <jinja2.environment.Environment object at 0x7f5c4cf5cf40>

    def test_dynamic_inheritance(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default1": "DEFAULT1{% block x %}{% endblock %}",
                    "default2": "DEFAULT2{% block x %}{% endblock %}",
                    "child": "{% extends default %}{% block x %}CHILD{% endblock %}",
                }
            )
        )
        tmpl = env.get_template("child")
        for m in range(1, 3):
>           assert tmpl.render(default=f"default{m}") == f"DEFAULT{m}CHILD"
E           AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:160: AttributeError
____________________ TestInheritance.test_multi_inheritance ____________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d35dc00>
env = <jinja2.environment.Environment object at 0x7f5c4cf244f0>

    def test_multi_inheritance(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default1": "DEFAULT1{% block x %}{% endblock %}",
                    "default2": "DEFAULT2{% block x %}{% endblock %}",
                    "child": (
                        "{% if default %}{% extends default %}{% else %}"
                        "{% extends 'default1' %}{% endif %}"
                        "{% block x %}CHILD{% endblock %}"
                    ),
                }
            )
        )
        tmpl = env.get_template("child")
>       assert tmpl.render(default="default2") == "DEFAULT2CHILD"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:177: AttributeError
______________________ TestInheritance.test_scoped_block _______________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d221030>
env = <jinja2.environment.Environment object at 0x7f5c4d059330>

    def test_scoped_block(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default.html": "{% for item in seq %}[{% block item scoped %}"
                    "{% endblock %}]{% endfor %}"
                }
            )
        )
        t = env.from_string(
            "{% extends 'default.html' %}{% block item %}{{ item }}{% endblock %}"
        )
>       assert t.render(seq=list(range(5))) == "[0][1][2][3][4]"
E       AssertionError: assert '' == '[0][1][2][3][4]'
E         
E         - [0][1][2][3][4]

tests/test_inheritance.py:193: AssertionError
__________________ TestInheritance.test_super_in_scoped_block __________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d220b50>
env = <jinja2.environment.Environment object at 0x7f5c4cf241f0>

    def test_super_in_scoped_block(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default.html": "{% for item in seq %}[{% block item scoped %}"
                    "{{ item }}{% endblock %}]{% endfor %}"
                }
            )
        )
        t = env.from_string(
            '{% extends "default.html" %}{% block item %}'
            "{{ super() }}|{{ item * 2 }}{% endblock %}"
        )
>       assert t.render(seq=list(range(5))) == "[0|0][1|2][2|4][3|6][4|8]"

tests/test_inheritance.py:208: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'super' is undefined

src/jinja2/runtime.py:551: UndefinedError
_____________ TestInheritance.test_scoped_block_after_inheritance ______________

self = <test_inheritance.TestInheritance object at 0x7f5c4d2209d0>
env = <jinja2.environment.Environment object at 0x7f5c4cce18d0>

    def test_scoped_block_after_inheritance(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "layout.html": """
            {% block useless %}{% endblock %}
            """,
                    "index.html": """
            {%- extends 'layout.html' %}
            {% from 'helpers.html' import foo with context %}
            {% block useless %}
                {% for x in [1, 2, 3] %}
                    {% block testing scoped %}
                        {{ foo(x) }}
                    {% endblock %}
                {% endfor %}
            {% endblock %}
            """,
                    "helpers.html": """
            {% macro foo(x) %}{{ the_foo + x }}{% endmacro %}
            """,
                }
            )
        )
>       rv = env.get_template("index.html").render(the_foo=42).split()
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:234: AttributeError
_____________________ TestInheritance.test_level1_required _____________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d221420>
env = <jinja2.environment.Environment object at 0x7f5c4cf23070>

    def test_level1_required(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default": "{% block x required %}{# comment #}\n {% endblock %}",
                    "level1": "{% extends 'default' %}{% block x %}[1]{% endblock %}",
                }
            )
        )
>       rv = env.get_template("level1").render()
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:246: AttributeError
_____________________ TestInheritance.test_level2_required _____________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d221720>
env = <jinja2.environment.Environment object at 0x7f5c4d2207f0>

    def test_level2_required(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default": "{% block x required %}{% endblock %}",
                    "level1": "{% extends 'default' %}{% block x %}[1]{% endblock %}",
                    "level2": "{% extends 'default' %}{% block x %}[2]{% endblock %}",
                }
            )
        )
>       rv1 = env.get_template("level1").render()
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:259: AttributeError
_____________________ TestInheritance.test_level3_required _____________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d221a50>
env = <jinja2.environment.Environment object at 0x7f5c4d04e200>

    def test_level3_required(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default": "{% block x required %}{% endblock %}",
                    "level1": "{% extends 'default' %}",
                    "level2": "{% extends 'level1' %}{% block x %}[2]{% endblock %}",
                    "level3": "{% extends 'level2' %}",
                }
            )
        )
        t1 = env.get_template("level1")
        t2 = env.get_template("level2")
        t3 = env.get_template("level3")
    
        with pytest.raises(TemplateRuntimeError, match="Required block 'x' not found"):
>           assert t1.render()
E           AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:281: AttributeError
____________________ TestInheritance.test_invalid_required _____________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d221d50>
env = <jinja2.environment.Environment object at 0x7f5c4ca4e6e0>

    def test_invalid_required(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "empty": "{% block x required %}{% endblock %}",
                    "blank": "{% block x required %} {# c #}{% endblock %}",
                    "text": "{% block x required %}data {# c #}{% endblock %}",
                    "block": "{% block x required %}{% block y %}"
                    "{% endblock %}{% endblock %}",
                    "if": "{% block x required %}{% if true %}"
                    "{% endif %}{% endblock %}",
                    "top": "{% extends t %}{% block x %}CHILD{% endblock %}",
                }
            )
        )
        t = env.get_template("top")
>       assert t.render(t="empty") == "CHILD"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:302: AttributeError
___________________ TestInheritance.test_required_with_scope ___________________

self = <test_inheritance.TestInheritance object at 0x7f5c4d222050>
env = <jinja2.environment.Environment object at 0x7f5c4cbd54b0>

    def test_required_with_scope(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default1": "{% for item in seq %}[{% block item scoped required %}"
                    "{% endblock %}]{% endfor %}",
                    "child1": "{% extends 'default1' %}{% block item %}"
                    "{{ item }}{% endblock %}",
                    "default2": "{% for item in seq %}[{% block item required scoped %}"
                    "{% endblock %}]{% endfor %}",
                    "child2": "{% extends 'default2' %}{% block item %}"
                    "{{ item }}{% endblock %}",
                }
            )
        )
        t1 = env.get_template("child1")
        t2 = env.get_template("child2")
    
>       assert t1.render(seq=list(range(3))) == "[0][1][2]"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:337: AttributeError
______________ TestInheritance.test_duplicate_required_or_scoped _______________

self = <test_inheritance.TestInheritance object at 0x7f5c4d222350>
env = <jinja2.environment.Environment object at 0x7f5c4caf6b00>

    def test_duplicate_required_or_scoped(self, env):
        env = Environment(
            loader=DictLoader(
                {
                    "default1": "{% for item in seq %}[{% block item "
                    "scoped scoped %}}{{% endblock %}}]{{% endfor %}}",
                    "default2": "{% for item in seq %}[{% block item "
                    "required required %}}{{% endblock %}}]{{% endfor %}}",
                    "child": "{% if default %}{% extends default %}{% else %}"
                    "{% extends 'default1' %}{% endif %}{%- block x %}"
                    "CHILD{% endblock %}",
                }
            )
        )
        tmpl = env.get_template("child")
    
        with pytest.raises(TemplateSyntaxError):
>           tmpl.render(default="default1", seq=list(range(3)))
E           AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:360: AttributeError
___________________ TestBugFix.test_fixed_macro_scoping_bug ____________________

self = <test_inheritance.TestBugFix object at 0x7f5c4d1c6950>
env = <jinja2.environment.Environment object at 0x7f5c4cf21120>

    def test_fixed_macro_scoping_bug(self, env):
        assert Environment(
            loader=DictLoader(
                {
                    "test.html": """\
        {% extends 'details.html' %}
    
        {% macro my_macro() %}
        my_macro
        {% endmacro %}
    
        {% block inner_box %}
            {{ my_macro() }}
        {% endblock %}
            """,
                    "details.html": """\
        {% extends 'standard.html' %}
    
        {% macro my_macro() %}
        my_macro
        {% endmacro %}
    
        {% block content %}
            {% block outer_box %}
                outer_box
                {% block inner_box %}
                    inner_box
                {% endblock %}
            {% endblock %}
        {% endblock %}
        """,
                    "standard.html": """
        {% block content %}&nbsp;{% endblock %}
        """,
                }
            )
>       ).get_template("test.html").render().split() == ["outer_box", "my_macro"]
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:403: AttributeError
________________________ TestBugFix.test_double_extends ________________________

self = <test_inheritance.TestBugFix object at 0x7f5c4d1ef250>
env = <jinja2.environment.Environment object at 0x7f5c4ce7e410>

    def test_double_extends(self, env):
        """Ensures that a template with more than 1 {% extends ... %} usage
        raises a ``TemplateError``.
        """
        with pytest.raises(TemplateRuntimeError, match="extended multiple times"):
>           env.get_template("doublee").render()
E           AttributeError: 'NoneType' object has no attribute 'render'

tests/test_inheritance.py:410: AttributeError
_____________________________ TestLexer.test_raw1 ______________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d222f50>
env = <jinja2.environment.Environment object at 0x7f5c4cce16f0>

    def test_raw1(self, env):
        tmpl = env.from_string(
            "{% raw %}foo{% endraw %}|"
            "{%raw%}{{ bar }}|{% baz %}{%       endraw    %}"
        )
>       assert tmpl.render() == "foo|{{ bar }}|{% baz %}"
E       AssertionError: assert 'foo' == 'foo|{{ bar }}|{% baz %}'
E         
E         - foo|{{ bar }}|{% baz %}
E         + foo

tests/test_lexnparse.py:49: AssertionError
_____________________________ TestLexer.test_raw2 ______________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d35dbd0>
env = <jinja2.environment.Environment object at 0x7f5c4cef0220>

    def test_raw2(self, env):
        tmpl = env.from_string("1  {%- raw -%}   2   {%- endraw -%}   3")
>       assert tmpl.render() == "123"
E       AssertionError: assert '1     2   ' == '123'
E         
E         - 123
E         + 1     2

tests/test_lexnparse.py:53: AssertionError
_____________________________ TestLexer.test_raw3 ______________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d222e00>
env = <jinja2.environment.Environment object at 0x7f5c4cac9ba0>

    def test_raw3(self, env):
        # The second newline after baz exists because it is AFTER the
        # {% raw %} and is ignored.
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string("bar\n{% raw %}\n  {{baz}}2 spaces\n{% endraw %}\nfoo")
>       assert tmpl.render(baz="test") == "bar\n\n  {{baz}}2 spaces\nfoo"
E       AssertionError: assert 'bar\n\n  test2 spaces' == 'bar\n\n  {{b...2 spaces\nfoo'
E         
E           bar
E           
E         +   test2 spaces
E         -   {{baz}}2 spaces
E         - foo

tests/test_lexnparse.py:60: AssertionError
_____________________________ TestLexer.test_raw4 ______________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d222740>
env = <jinja2.environment.Environment object at 0x7f5c4cf23ee0>

    def test_raw4(self, env):
        # The trailing dash of the {% raw -%} cleans both the spaces and
        # newlines up to the first character of data.
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string(
            "bar\n{%- raw -%}\n\n  \n  2 spaces\n space{%- endraw -%}\nfoo"
        )
>       assert tmpl.render() == "bar2 spaces\n spacefoo"
E       AssertionError: assert 'bar\n\n\n  \...paces\n space' == 'bar2 spaces\n spacefoo'
E         
E         + bar
E         + 
E         + 
E         +   
E         - bar2 spaces
E         ? ^^^...
E         
E         ...Full output truncated (5 lines hidden), use '-vv' to show

tests/test_lexnparse.py:69: AssertionError
___________________________ TestLexer.test_balancing ___________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d223220>
env = <jinja2.environment.Environment object at 0x7f5c4caf5ba0>

    def test_balancing(self, env):
        env = Environment("{%", "%}", "${", "}")
        tmpl = env.from_string(
            """{% for item in seq
            %}${{'foo': item}|upper}{% endfor %}"""
        )
>       assert tmpl.render(seq=list(range(3))) == "{'FOO': 0}{'FOO': 1}{'FOO': 2}"

tests/test_lexnparse.py:77: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = "{'foo': item"
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4caf5ba0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           {'foo': item
E           ^
E       SyntaxError: '{' was never closed

src/jinja2/environment.py:915: SyntaxError
___________________________ TestLexer.test_comments ____________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d223550>
env = <jinja2.environment.Environment object at 0x7f5c4ce4e170>

        def test_comments(self, env):
            env = Environment("<!--", "-->", "{", "}")
            tmpl = env.from_string(
                """\
    <ul>
    <!--- for item in seq -->
      <li>{item}</li>
    <!--- endfor -->
    </ul>"""
            )
>           assert tmpl.render(seq=list(range(3))) == (
                "<ul>\n  <li>0</li>\n  <li>1</li>\n  <li>2</li>\n</ul>"
            )
E           AssertionError: assert '<ul>\n\n  <l.../li>\n\n</ul>' == '<ul>\n  <li>...2</li>\n</ul>'
E             
E               <ul>
E             + 
E                 <li>0</li>
E             + 
E                 <li>1</li>
E             + ...
E             
E             ...Full output truncated (3 lines hidden), use '-vv' to show

tests/test_lexnparse.py:89: AssertionError
________________________ TestLexer.test_string_escapes _________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d223880>
env = <jinja2.environment.Environment object at 0x7f5c4cf58790>

    def test_string_escapes(self, env):
        for char in "\0", "\u2668", "\xe4", "\t", "\r", "\n":
            tmpl = env.from_string(f"{{{{ {char!r} }}}}")
>           assert tmpl.render() == char
E           AssertionError: assert '\n' == '\r'
E             
E             Strings contain only whitespace, escaping them using repr()
E             - '\r'
E             ?   ^
E             + '\n'
E             ?   ^

tests/test_lexnparse.py:96: AssertionError
___________________________ TestLexer.test_operators ___________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d223ee0>
env = <jinja2.environment.Environment object at 0x7f5c4c980c70>

    def test_operators(self, env):
        from jinja2.lexer import operators
    
        for test, expect in operators.items():
            if test in "([{}])":
                continue
>           stream = env.lexer.tokenize(f"{{{{ {test} }}}}")
E           AttributeError: 'NoneType' object has no attribute 'tokenize'

tests/test_lexnparse.py:111: AttributeError
________________________ TestLexer.test_name[1a-False] _________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d265210>
env = <jinja2.environment.Environment object at 0x7f5c4c904520>, name = '1a'
valid = False

    @pytest.mark.parametrize(
        ("name", "valid"),
        [
            ("foo", True),
            ("föö", True),
            ("き", True),
            ("_", True),
            ("1a", False),  # invalid ascii start
            ("a-", False),  # invalid ascii continue
            ("\U0001f40da", False),  # invalid unicode start
            ("a🐍\U0001f40d", False),  # invalid unicode continue
            # start characters not matched by \w
            ("\u1885", True),
            ("\u1886", True),
            ("\u2118", True),
            ("\u212e", True),
            # continue character not matched by \w
            ("\xb7", False),
            ("a\xb7", True),
        ],
    )
    def test_name(self, env, name, valid):
        t = "{{ " + name + " }}"
    
        if valid:
            # valid for version being tested, shouldn't raise
            env.from_string(t)
        else:
>           pytest.raises(TemplateSyntaxError, env.from_string, t)
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:164: Failed
________________________ TestLexer.test_name[a--False] _________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d2652d0>
env = <jinja2.environment.Environment object at 0x7f5c4cf21450>, name = 'a-'
valid = False

    @pytest.mark.parametrize(
        ("name", "valid"),
        [
            ("foo", True),
            ("föö", True),
            ("き", True),
            ("_", True),
            ("1a", False),  # invalid ascii start
            ("a-", False),  # invalid ascii continue
            ("\U0001f40da", False),  # invalid unicode start
            ("a🐍\U0001f40d", False),  # invalid unicode continue
            # start characters not matched by \w
            ("\u1885", True),
            ("\u1886", True),
            ("\u2118", True),
            ("\u212e", True),
            # continue character not matched by \w
            ("\xb7", False),
            ("a\xb7", True),
        ],
    )
    def test_name(self, env, name, valid):
        t = "{{ " + name + " }}"
    
        if valid:
            # valid for version being tested, shouldn't raise
            env.from_string(t)
        else:
>           pytest.raises(TemplateSyntaxError, env.from_string, t)
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:164: Failed
____________________ TestLexer.test_name[\U0001f40da-False] ____________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d265390>
env = <jinja2.environment.Environment object at 0x7f5c4d03d1b0>, name = '🐍a'
valid = False

    @pytest.mark.parametrize(
        ("name", "valid"),
        [
            ("foo", True),
            ("föö", True),
            ("き", True),
            ("_", True),
            ("1a", False),  # invalid ascii start
            ("a-", False),  # invalid ascii continue
            ("\U0001f40da", False),  # invalid unicode start
            ("a🐍\U0001f40d", False),  # invalid unicode continue
            # start characters not matched by \w
            ("\u1885", True),
            ("\u1886", True),
            ("\u2118", True),
            ("\u212e", True),
            # continue character not matched by \w
            ("\xb7", False),
            ("a\xb7", True),
        ],
    )
    def test_name(self, env, name, valid):
        t = "{{ " + name + " }}"
    
        if valid:
            # valid for version being tested, shouldn't raise
            env.from_string(t)
        else:
>           pytest.raises(TemplateSyntaxError, env.from_string, t)
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:164: Failed
_______________ TestLexer.test_name[a\U0001f40d\U0001f40d-False] _______________

self = <test_lexnparse.TestLexer object at 0x7f5c4d265450>
env = <jinja2.environment.Environment object at 0x7f5c4d0400d0>, name = 'a🐍🐍'
valid = False

    @pytest.mark.parametrize(
        ("name", "valid"),
        [
            ("foo", True),
            ("föö", True),
            ("き", True),
            ("_", True),
            ("1a", False),  # invalid ascii start
            ("a-", False),  # invalid ascii continue
            ("\U0001f40da", False),  # invalid unicode start
            ("a🐍\U0001f40d", False),  # invalid unicode continue
            # start characters not matched by \w
            ("\u1885", True),
            ("\u1886", True),
            ("\u2118", True),
            ("\u212e", True),
            # continue character not matched by \w
            ("\xb7", False),
            ("a\xb7", True),
        ],
    )
    def test_name(self, env, name, valid):
        t = "{{ " + name + " }}"
    
        if valid:
            # valid for version being tested, shouldn't raise
            env.from_string(t)
        else:
>           pytest.raises(TemplateSyntaxError, env.from_string, t)
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:164: Failed
_______________________ TestLexer.test_name[\xb7-False] ________________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d2239a0>
env = <jinja2.environment.Environment object at 0x7f5c4c8ccfd0>, name = '·'
valid = False

    @pytest.mark.parametrize(
        ("name", "valid"),
        [
            ("foo", True),
            ("föö", True),
            ("き", True),
            ("_", True),
            ("1a", False),  # invalid ascii start
            ("a-", False),  # invalid ascii continue
            ("\U0001f40da", False),  # invalid unicode start
            ("a🐍\U0001f40d", False),  # invalid unicode continue
            # start characters not matched by \w
            ("\u1885", True),
            ("\u1886", True),
            ("\u2118", True),
            ("\u212e", True),
            # continue character not matched by \w
            ("\xb7", False),
            ("a\xb7", True),
        ],
    )
    def test_name(self, env, name, valid):
        t = "{{ " + name + " }}"
    
        if valid:
            # valid for version being tested, shouldn't raise
            env.from_string(t)
        else:
>           pytest.raises(TemplateSyntaxError, env.from_string, t)
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:164: Failed
_______________________ TestLexer.test_lineno_with_strip _______________________

self = <test_lexnparse.TestLexer object at 0x7f5c4d223640>
env = <jinja2.environment.Environment object at 0x7f5c4cbd80a0>

        def test_lineno_with_strip(self, env):
            tokens = env.lex(
                """\
    <html>
        <body>
        {%- block content -%}
            <hr>
            {{ item }}
        {% endblock %}
        </body>
    </html>"""
            )
>           for tok in tokens:
E           TypeError: 'NoneType' object is not iterable

tests/test_lexnparse.py:178: TypeError
__________________________ TestParser.test_php_syntax __________________________

self = <test_lexnparse.TestParser object at 0x7f5c4d222aa0>
env = <jinja2.environment.Environment object at 0x7f5c4d2651e0>

        def test_php_syntax(self, env):
            env = Environment("<?", "?>", "<?=", "?>", "<!--", "-->")
            tmpl = env.from_string(
                """\
    <!-- I'm a comment, I'm not interesting -->\
    <? for item in seq -?>
        <?= item ?>
    <?- endfor ?>"""
            )
>           assert tmpl.render(seq=list(range(5))) == "01234"
E           AssertionError: assert '\n    0\n\n ...   3\n\n    4' == '01234'
E             
E             - 01234
E             + 
E             +     0
E             + 
E             +     1
E             + ...
E             
E             ...Full output truncated (5 lines hidden), use '-vv' to show

tests/test_lexnparse.py:195: AssertionError
__________________________ TestParser.test_erb_syntax __________________________

self = <test_lexnparse.TestParser object at 0x7f5c4d222e60>
env = <jinja2.environment.Environment object at 0x7f5c4c944940>

        def test_erb_syntax(self, env):
            env = Environment("<%", "%>", "<%=", "%>", "<%#", "%>")
            tmpl = env.from_string(
                """\
    <%# I'm a comment, I'm not interesting %>\
    <% for item in seq -%>
        <%= item %>
    <%- endfor %>"""
            )
>           assert tmpl.render(seq=list(range(5))) == "01234"
E           AssertionError: assert '\n    0\n\n ...   3\n\n    4' == '01234'
E             
E             - 01234
E             + 
E             +     0
E             + 
E             +     1
E             + ...
E             
E             ...Full output truncated (5 lines hidden), use '-vv' to show

tests/test_lexnparse.py:206: AssertionError
________________________ TestParser.test_comment_syntax ________________________

self = <test_lexnparse.TestParser object at 0x7f5c4d264730>
env = <jinja2.environment.Environment object at 0x7f5c4d222410>

        def test_comment_syntax(self, env):
            env = Environment("<!--", "-->", "${", "}", "<!--#", "-->")
            tmpl = env.from_string(
                """\
    <!--# I'm a comment, I'm not interesting -->\
    <!-- for item in seq --->
        ${item}
    <!--- endfor -->"""
            )
>           assert tmpl.render(seq=list(range(5))) == "01234"
E           AssertionError: assert '\n    0\n\n ...   3\n\n    4' == '01234'
E             
E             - 01234
E             + 
E             +     0
E             + 
E             +     1
E             + ...
E             
E             ...Full output truncated (5 lines hidden), use '-vv' to show

tests/test_lexnparse.py:217: AssertionError
__________________________ TestParser.test_balancing ___________________________

self = <test_lexnparse.TestParser object at 0x7f5c4d264100>
env = <jinja2.environment.Environment object at 0x7f5c4ce49ab0>

    def test_balancing(self, env):
        tmpl = env.from_string("""{{{'foo':'bar'}.foo}}""")
>       assert tmpl.render() == "bar"

tests/test_lexnparse.py:221: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'dict' object has no attribute 'foo'

<string>:1: AttributeError
_________________________ TestParser.test_line_syntax __________________________

self = <test_lexnparse.TestParser object at 0x7f5c4d265b70>
env = <jinja2.environment.Environment object at 0x7f5c4cf54280>

        def test_line_syntax(self, env):
            env = Environment("<%", "%>", "${", "}", "<%#", "%>", "%")
            tmpl = env.from_string(
                """\
    <%# regular comment %>
    % for item in seq:
        ${item}
    % endfor"""
            )
>           assert [
                int(x.strip()) for x in tmpl.render(seq=list(range(5))).split()
            ] == list(range(5))

tests/test_lexnparse.py:241: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

.0 = <list_iterator object at 0x7f5c4cf57ee0>

    assert [
>       int(x.strip()) for x in tmpl.render(seq=list(range(5))).split()
    ] == list(range(5))
E   ValueError: invalid literal for int() with base 10: '%'

tests/test_lexnparse.py:242: ValueError
_____________________ TestParser.test_line_syntax_priority _____________________

self = <test_lexnparse.TestParser object at 0x7f5c4d265ed0>
env = <jinja2.environment.Environment object at 0x7f5c4caf7370>

        def test_line_syntax_priority(self, env):
            # XXX: why is the whitespace there in front of the newline?
            env = Environment("{%", "%}", "${", "}", "/*", "*/", "##", "#")
            tmpl = env.from_string(
                """\
    /* ignore me.
       I'm a multiline comment */
    ## for item in seq:
    * ${item}          # this is just extra stuff
    ## endfor"""
            )
>           assert tmpl.render(seq=[1, 2]).strip() == "* 1\n* 2"
E           AssertionError: assert '## for item ...ff\n## endfor' == '* 1\n* 2'
E             
E             - * 1
E             - * 2
E             + ## for item in seq:
E             + *           # this is just extra stuff
E             + ## endfor

tests/test_lexnparse.py:268: AssertionError
________________________ TestParser.test_error_messages ________________________

self = <test_lexnparse.TestParser object at 0x7f5c4d266200>
env = <jinja2.environment.Environment object at 0x7f5c4ca3f1f0>

    def test_error_messages(self, env):
        def assert_error(code, expected):
            with pytest.raises(TemplateSyntaxError, match=expected):
                Template(code)
    
>       assert_error(
            "{% for item in seq %}...{% endif %}",
            "Encountered unknown tag 'endif'. Jinja was looking "
            "for the following tags: 'endfor' or 'else'. The "
            "innermost block that needs to be closed is 'for'.",
        )

tests/test_lexnparse.py:286: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

code = '{% for item in seq %}...{% endif %}'
expected = "Encountered unknown tag 'endif'. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'."

    def assert_error(code, expected):
>       with pytest.raises(TemplateSyntaxError, match=expected):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:283: Failed
____________________________ TestSyntax.test_unary _____________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d266080>
env = <jinja2.environment.Environment object at 0x7f5c4caf7e20>

    def test_unary(self, env):
        tmpl = env.from_string("{{ +3 }}|{{ -3 }}")
>       assert tmpl.render() == "3|-3"
E       AssertionError: assert '3|3' == '3|-3'
E         
E         - 3|-3
E         ?   -
E         + 3|3

tests/test_lexnparse.py:351: AssertionError
____________________________ TestSyntax.test_concat ____________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d265960>
env = <jinja2.environment.Environment object at 0x7f5c4ca3d7b0>

    def test_concat(self, env):
        tmpl = env.from_string("{{ [1, 2] ~ 'foo' }}")
>       assert tmpl.render() == "[1, 2]foo"

tests/test_lexnparse.py:355: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = "[1, 2] ~ 'foo'"
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4ca3d7b0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           [1, 2] ~ 'foo'
E                  ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_________________________ TestSyntax.test_django_attr __________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d089870>
env = <jinja2.environment.Environment object at 0x7f5c4ca4fbb0>

    def test_django_attr(self, env):
        tmpl = env.from_string("{{ [1, 2, 3].0 }}|{{ [[1]].0.0 }}")
>       assert tmpl.render() == "1|1"

tests/test_lexnparse.py:442: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '[1, 2, 3].0'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4ca4fbb0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           [1, 2, 3].0
E                    ^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_________________ TestSyntax.test_short_conditional_expression _________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d265c90>
env = <jinja2.environment.Environment object at 0x7f5c4cbdab60>

    def test_short_conditional_expression(self, env):
        tmpl = env.from_string("<{{ 1 if false }}>")
>       assert tmpl.render() == "<>"

tests/test_lexnparse.py:450: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '1 if False'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cbdab60>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           1 if False
E           ^^^^^^^^^^
E       SyntaxError: expected 'else' after 'if' expression

src/jinja2/environment.py:915: SyntaxError
_______________________ TestSyntax.test_filter_priority ________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d089d50>
env = <jinja2.environment.Environment object at 0x7f5c4ce48c70>

    def test_filter_priority(self, env):
        tmpl = env.from_string('{{ "foo"|upper + "bar"|upper }}')
>       assert tmpl.render() == "FOOBAR"

tests/test_lexnparse.py:457: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:1025: in <lambda>
    Environment.call_filter = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.filters,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ce48c70>
mapping = {'abs': <built-in function abs>, 'attr': <function do_attr at 0x7f5c4d53f6d0>, 'batch': <function do_batch at 0x7f5c4d53ee60>, 'capitalize': <function do_capitalize at 0x7f5c4d53dfc0>, ...}
name = 'upper + "bar"', value = 'foo', args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...jinja2.utils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'upper + "bar"'

src/jinja2/environment.py:1019: KeyError
________________________ TestSyntax.test_function_calls ________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d089720>
env = <jinja2.environment.Environment object at 0x7f5c4d04ffa0>

    def test_function_calls(self, env):
        tests = [
            (True, "*foo, bar"),
            (True, "*foo, *bar"),
            (True, "**foo, *bar"),
            (True, "**foo, bar"),
            (True, "**foo, **bar"),
            (True, "**foo, bar=42"),
            (False, "foo, bar"),
            (False, "foo, bar=42"),
            (False, "foo, bar=23, *args"),
            (False, "foo, *args, bar=23"),
            (False, "a, b=c, *d, **e"),
            (False, "*foo, bar=42"),
            (False, "*foo, **bar"),
            (False, "*foo, bar=42, **baz"),
            (False, "foo, *args, bar=23, **baz"),
        ]
        for should_fail, sig in tests:
            if should_fail:
>               with pytest.raises(TemplateSyntaxError):
E               Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:479: Failed
________________________ TestSyntax.test_block_end_name ________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08a410>
env = <jinja2.environment.Environment object at 0x7f5c4ca3ec20>

    def test_block_end_name(self, env):
        env.from_string("{% block foo %}...{% endblock foo %}")
>       pytest.raises(
            TemplateSyntaxError, env.from_string, "{% block x %}{% endblock y %}"
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:503: Failed
_______________________ TestSyntax.test_constant_casing ________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08a740>
env = <jinja2.environment.Environment object at 0x7f5c4cef3700>

    def test_constant_casing(self, env):
        for const in True, False, None:
            const = str(const)
            tmpl = env.from_string(
                f"{{{{ {const} }}}}|{{{{ {const.lower()} }}}}|{{{{ {const.upper()} }}}}"
            )
>           assert tmpl.render() == f"{const}|{const}|"
E           AssertionError: assert 'True|True|True' == 'True|True|'
E             
E             - True|True|
E             + True|True|True
E             ?           ++++

tests/test_lexnparse.py:513: AssertionError
________________________ TestSyntax.test_test_chaining _________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08aa70>
env = <jinja2.environment.Environment object at 0x7f5c4cf5b040>

    def test_test_chaining(self, env):
>       pytest.raises(
            TemplateSyntaxError, env.from_string, "{{ foo is string is sequence }}"
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:516: Failed
_____________________________ TestSyntax.test_raw2 _____________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08ba60>
env = <jinja2.environment.Environment object at 0x7f5c4ce39420>

    def test_raw2(self, env):
        tmpl = env.from_string("{% raw %}{{ FOO }} and {% BAR %}{% endraw %}")
>       assert tmpl.render() == "{{ FOO }} and {% BAR %}"
E       AssertionError: assert ' and ' == '{{ FOO }} and {% BAR %}'
E         
E         - {{ FOO }} and {% BAR %}
E         +  and

tests/test_lexnparse.py:544: AssertionError
____________________________ TestSyntax.test_const _____________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08bd90>
env = <jinja2.environment.Environment object at 0x7f5c4c8cec20>

    def test_const(self, env):
        tmpl = env.from_string(
            "{{ true }}|{{ false }}|{{ none }}|"
            "{{ none is defined }}|{{ missing is defined }}"
        )
>       assert tmpl.render() == "True|False|None|True|False"
E       AssertionError: assert 'True|False||True|False' == 'True|False|None|True|False'
E         
E         - True|False|None|True|False
E         ?            ----
E         + True|False||True|False

tests/test_lexnparse.py:551: AssertionError
_____________________ TestSyntax.test_neg_filter_priority ______________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d0a4100>
env = <jinja2.environment.Environment object at 0x7f5c4d043ca0>

    def test_neg_filter_priority(self, env):
        node = env.parse("{{ -1|foo }}")
>       assert isinstance(node.body[0].nodes[0], nodes.Filter)
E       AttributeError: 'NoneType' object has no attribute 'body'

tests/test_lexnparse.py:555: AttributeError
_________________________ TestSyntax.test_const_assign _________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08bca0>
env = <jinja2.environment.Environment object at 0x7f5c4d05dde0>

    def test_const_assign(self, env):
        constass1 = """{% set true = 42 %}"""
        constass2 = """{% for none in seq %}{% endfor %}"""
        for tmpl in constass1, constass2:
>           pytest.raises(TemplateSyntaxError, env.from_string, tmpl)
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_lexnparse.py:562: Failed
___________________________ TestSyntax.test_localset ___________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08b5b0>
env = <jinja2.environment.Environment object at 0x7f5c4cacbdc0>

        def test_localset(self, env):
            tmpl = env.from_string(
                """{% set foo = 0 %}\
    {% for item in [1, 2] %}{% set foo = 1 %}{% endfor %}\
    {{ foo }}"""
            )
>           assert tmpl.render() == "0"
E           AssertionError: assert '1' == '0'
E             
E             - 0
E             + 1

tests/test_lexnparse.py:570: AssertionError
_________________________ TestSyntax.test_parse_unary __________________________

self = <test_lexnparse.TestSyntax object at 0x7f5c4d08aec0>
env = <jinja2.environment.Environment object at 0x7f5c4c947a00>

    def test_parse_unary(self, env):
        tmpl = env.from_string('{{ -foo["bar"] }}')
>       assert tmpl.render(foo={"bar": 42}) == "-42"
E       AssertionError: assert '42' == '-42'
E         
E         - -42
E         ? -
E         + 42

tests/test_lexnparse.py:574: AssertionError
_________________________ TestLstripBlocks.test_lstrip _________________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d08a860>
env = <jinja2.environment.Environment object at 0x7f5c4cac90f0>

    def test_lstrip(self, env):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string("""    {% if True %}\n    {% endif %}""")
>       assert tmpl.render() == "\n"
E       AssertionError: assert '    \n    ' == '\n'
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '\n'
E         + '    \n    '

tests/test_lexnparse.py:583: AssertionError
______________________ TestLstripBlocks.test_lstrip_trim _______________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d08a710>
env = <jinja2.environment.Environment object at 0x7f5c4c945bd0>

    def test_lstrip_trim(self, env):
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string("""    {% if True %}\n    {% endif %}""")
>       assert tmpl.render() == ""
E       AssertionError: assert '    \n    ' == ''
E         
E         Strings contain only whitespace, escaping them using repr()
E         - ''
E         + '    \n    '

tests/test_lexnparse.py:588: AssertionError
_____________________ TestLstripBlocks.test_lstrip_inline ______________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a4400>
env = <jinja2.environment.Environment object at 0x7f5c4cac9810>

    def test_lstrip_inline(self, env):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string("""    {% if True %}hello    {% endif %}""")
>       assert tmpl.render() == "hello    "
E       AssertionError: assert '    hello    ' == 'hello    '
E         
E         - hello    
E         +     hello    
E         ? ++++

tests/test_lexnparse.py:611: AssertionError
_____________________ TestLstripBlocks.test_lstrip_nested ______________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a4730>
env = <jinja2.environment.Environment object at 0x7f5c4d05dfc0>

    def test_lstrip_nested(self, env):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string(
            """    {% if True %}a {% if True %}b {% endif %}c {% endif %}"""
        )
>       assert tmpl.render() == "a b c "
E       AssertionError: assert '    a b c ' == 'a b c '
E         
E         - a b c 
E         +     a b c 
E         ? ++++

tests/test_lexnparse.py:618: AssertionError
_________________ TestLstripBlocks.test_lstrip_embeded_strings _________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a4d90>
env = <jinja2.environment.Environment object at 0x7f5c4cbda980>

    def test_lstrip_embeded_strings(self, env):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string("""    {% set x = " {% str %} " %}{{ x }}""")
>       assert tmpl.render() == " {% str %} "

tests/test_lexnparse.py:631: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:953: in _render_tokens
    k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '" {% str'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cbda980>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           " {% str
E           ^
E       SyntaxError: unterminated string literal (detected at line 1)

src/jinja2/environment.py:915: SyntaxError
____________ TestLstripBlocks.test_lstrip_preserve_leading_newlines ____________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a50c0>
env = <jinja2.environment.Environment object at 0x7f5c4cf599f0>

    def test_lstrip_preserve_leading_newlines(self, env):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string("""\n\n\n{% set hello = 1 %}""")
>       assert tmpl.render() == "\n\n\n"
E       AssertionError: assert '\n\n' == '\n\n\n'
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '\n\n\n'
E         ?      --
E         + '\n\n'

tests/test_lexnparse.py:636: AssertionError
_____________________ TestLstripBlocks.test_lstrip_comment _____________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0894e0>
env = <jinja2.environment.Environment object at 0x7f5c4caf53c0>

        def test_lstrip_comment(self, env):
            env = Environment(lstrip_blocks=True, trim_blocks=False)
            tmpl = env.from_string(
                """    {# if True #}
    hello
        {#endif#}"""
            )
>           assert tmpl.render() == "\nhello\n"
E           AssertionError: assert '    \nhello\n    ' == '\nhello\n'
E             
E             - 
E             +     
E               hello
E             +

tests/test_lexnparse.py:645: AssertionError
______________ TestLstripBlocks.test_lstrip_angle_bracket_simple _______________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0892a0>
env = <jinja2.environment.Environment object at 0x7f5c4cf58640>

    def test_lstrip_angle_bracket_simple(self, env):
        env = Environment(
            "<%",
            "%>",
            "${",
            "}",
            "<%#",
            "%>",
            "%",
            "##",
            lstrip_blocks=True,
            trim_blocks=True,
        )
        tmpl = env.from_string("""    <% if True %>hello    <% endif %>""")
>       assert tmpl.render() == "hello    "
E       AssertionError: assert '    hello    ' == 'hello    '
E         
E         - hello    
E         +     hello    
E         ? ++++

tests/test_lexnparse.py:661: AssertionError
______________ TestLstripBlocks.test_lstrip_angle_bracket_comment ______________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d08aaa0>
env = <jinja2.environment.Environment object at 0x7f5c4caf4b20>

    def test_lstrip_angle_bracket_comment(self, env):
        env = Environment(
            "<%",
            "%>",
            "${",
            "}",
            "<%#",
            "%>",
            "%",
            "##",
            lstrip_blocks=True,
            trim_blocks=True,
        )
        tmpl = env.from_string("""    <%# if True %>hello    <%# endif %>""")
>       assert tmpl.render() == "hello    "
E       AssertionError: assert '    hello    ' == 'hello    '
E         
E         - hello    
E         +     hello    
E         ? ++++

tests/test_lexnparse.py:677: AssertionError
__________________ TestLstripBlocks.test_lstrip_angle_bracket __________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d08b760>
env = <jinja2.environment.Environment object at 0x7f5c4ce48c40>

        def test_lstrip_angle_bracket(self, env):
            env = Environment(
                "<%",
                "%>",
                "${",
                "}",
                "<%#",
                "%>",
                "%",
                "##",
                lstrip_blocks=True,
                trim_blocks=True,
            )
            tmpl = env.from_string(
                """\
        <%# regular comment %>
        <% for item in seq %>
    ${item} ## the rest of the stuff
       <% endfor %>"""
            )
>           assert tmpl.render(seq=range(5)) == "".join(f"{x}\n" for x in range(5))
E           AssertionError: assert '    \n    \n...he stuff\n   ' == '0\n1\n2\n3\n4\n'
E             
E             - 0
E             - 1
E             - 2
E             - 3
E             - 4
E             +     ...
E             
E             ...Full output truncated (11 lines hidden), use '-vv' to show

tests/test_lexnparse.py:699: AssertionError
______________ TestLstripBlocks.test_lstrip_angle_bracket_compact ______________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a5210>
env = <jinja2.environment.Environment object at 0x7f5c4caf62f0>

        def test_lstrip_angle_bracket_compact(self, env):
            env = Environment(
                "<%",
                "%>",
                "${",
                "}",
                "<%#",
                "%>",
                "%",
                "##",
                lstrip_blocks=True,
                trim_blocks=True,
            )
            tmpl = env.from_string(
                """\
        <%#regular comment%>
        <%for item in seq%>
    ${item} ## the rest of the stuff
       <%endfor%>"""
            )
>           assert tmpl.render(seq=range(5)) == "".join(f"{x}\n" for x in range(5))
E           AssertionError: assert '    \n    \n...he stuff\n   ' == '0\n1\n2\n3\n4\n'
E             
E             - 0
E             - 1
E             - 2
E             - 3
E             - 4
E             +     ...
E             
E             ...Full output truncated (11 lines hidden), use '-vv' to show

tests/test_lexnparse.py:721: AssertionError
__________ TestLstripBlocks.test_lstrip_blocks_outside_with_new_line ___________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a4ca0>

    def test_lstrip_blocks_outside_with_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string(
            "  {% if kvs %}(\n"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor %}\n"
            "  ){% endif %}"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "(\na=1 b=2 \n  )"
E       AssertionError: assert '  (\n   a=1 b=2 \n  )' == '(\na=1 b=2 \n  )'
E         
E         - (
E         +   (
E         - a=1 b=2 
E         +    a=1 b=2 
E         ? +++
E             )

tests/test_lexnparse.py:731: AssertionError
________ TestLstripBlocks.test_lstrip_trim_blocks_outside_with_new_line ________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a4520>

    def test_lstrip_trim_blocks_outside_with_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string(
            "  {% if kvs %}(\n"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor %}\n"
            "  ){% endif %}"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "(\na=1 b=2   )"
E       AssertionError: assert '  (\n   a=1 b=2 \n  )' == '(\na=1 b=2   )'
E         
E         - (
E         - a=1 b=2   )
E         +   (
E         +    a=1 b=2 
E         +   )

tests/test_lexnparse.py:741: AssertionError
___________ TestLstripBlocks.test_lstrip_blocks_inside_with_new_line ___________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a4340>

    def test_lstrip_blocks_inside_with_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string(
            "  ({% if kvs %}\n"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor %}\n"
            "  {% endif %})"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "  (\na=1 b=2 \n)"
E       AssertionError: assert '  (\n   a=1 b=2 \n  )' == '  (\na=1 b=2 \n)'
E         
E             (
E         - a=1 b=2 
E         +    a=1 b=2 
E         ? +++
E         - )
E         +   )

tests/test_lexnparse.py:751: AssertionError
________ TestLstripBlocks.test_lstrip_trim_blocks_inside_with_new_line _________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a5480>

    def test_lstrip_trim_blocks_inside_with_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string(
            "  ({% if kvs %}\n"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor %}\n"
            "  {% endif %})"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "  (a=1 b=2 )"
E       AssertionError: assert '  (\n   a=1 b=2 \n  )' == '  (a=1 b=2 )'
E         
E         +   (
E         -   (a=1 b=2 )
E         ?   ^        ^
E         +    a=1 b=2 
E         ?   ^        ^
E         +   )

tests/test_lexnparse.py:761: AssertionError
_____________ TestLstripBlocks.test_lstrip_blocks_without_new_line _____________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a5750>

    def test_lstrip_blocks_without_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string(
            "  {% if kvs %}"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor %}"
            "  {% endif %}"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "   a=1 b=2   "
E       AssertionError: assert '     a=1 b=2   ' == '   a=1 b=2   '
E         
E         -    a=1 b=2   
E         +      a=1 b=2   
E         ? ++

tests/test_lexnparse.py:771: AssertionError
__________ TestLstripBlocks.test_lstrip_trim_blocks_without_new_line ___________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a5a20>

    def test_lstrip_trim_blocks_without_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string(
            "  {% if kvs %}"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor %}"
            "  {% endif %}"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "   a=1 b=2   "
E       AssertionError: assert '     a=1 b=2   ' == '   a=1 b=2   '
E         
E         -    a=1 b=2   
E         +      a=1 b=2   
E         ? ++

tests/test_lexnparse.py:781: AssertionError
______ TestLstripBlocks.test_lstrip_blocks_consume_after_without_new_line ______

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a5cf0>

    def test_lstrip_blocks_consume_after_without_new_line(self):
        env = Environment(lstrip_blocks=True, trim_blocks=False)
        tmpl = env.from_string(
            "  {% if kvs -%}"
            "   {% for k, v in kvs %}{{ k }}={{ v }} {% endfor -%}"
            "  {% endif -%}"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "a=1 b=2 "
E       AssertionError: assert '     a=1 b=2   ' == 'a=1 b=2 '
E         
E         - a=1 b=2 
E         +      a=1 b=2

tests/test_lexnparse.py:791: AssertionError
___ TestLstripBlocks.test_lstrip_trim_blocks_consume_before_without_new_line ___

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a5fc0>

    def test_lstrip_trim_blocks_consume_before_without_new_line(self):
        env = Environment(lstrip_blocks=False, trim_blocks=False)
        tmpl = env.from_string(
            "  {%- if kvs %}"
            "   {%- for k, v in kvs %}{{ k }}={{ v }} {% endfor -%}"
            "  {%- endif %}"
        )
        out = tmpl.render(kvs=[("a", 1), ("b", 2)])
>       assert out == "a=1 b=2 "
E       AssertionError: assert '     a=1 b=2   ' == 'a=1 b=2 '
E         
E         - a=1 b=2 
E         +      a=1 b=2

tests/test_lexnparse.py:801: AssertionError
_______________ TestLstripBlocks.test_lstrip_trim_blocks_comment _______________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a6290>

    def test_lstrip_trim_blocks_comment(self):
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string(" {# 1 space #}\n  {# 2 spaces #}    {# 4 spaces #}")
        out = tmpl.render()
>       assert out == " " * 4
E       AssertionError: assert ' \n      ' == '    '
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '    '
E         + ' \n      '

tests/test_lexnparse.py:807: AssertionError
_________________ TestLstripBlocks.test_lstrip_trim_blocks_raw _________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a6560>

    def test_lstrip_trim_blocks_raw(self):
        env = Environment(lstrip_blocks=True, trim_blocks=True)
        tmpl = env.from_string("{{x}}\n{%- raw %} {% endraw -%}\n{{ y }}")
        out = tmpl.render(x=1, y=2)
>       assert out == "1 2"
E       AssertionError: assert '1\n ' == '1 2'
E         
E         - 1 2
E         + 1
E         +

tests/test_lexnparse.py:813: AssertionError
_________________ TestLstripBlocks.test_php_syntax_with_manual _________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a6830>
env = <jinja2.environment.Environment object at 0x7f5c4c946860>

    def test_php_syntax_with_manual(self, env):
        env = Environment(
            "<?", "?>", "<?=", "?>", "<!--", "-->", lstrip_blocks=True, trim_blocks=True
        )
        tmpl = env.from_string(
            """\
    <!-- I'm a comment, I'm not interesting -->
    <? for item in seq -?>
        <?= item ?>
    <?- endfor ?>"""
        )
>       assert tmpl.render(seq=range(5)) == "01234"
E       AssertionError: assert '    \n    \n...      4\n    ' == '01234'
E         
E         - 01234
E         +     
E         +     
E         +         0
E         +     
E         +         1...
E         
E         ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_lexnparse.py:826: AssertionError
_______________________ TestLstripBlocks.test_php_syntax _______________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a6b00>
env = <jinja2.environment.Environment object at 0x7f5c4ce7f670>

    def test_php_syntax(self, env):
        env = Environment(
            "<?", "?>", "<?=", "?>", "<!--", "-->", lstrip_blocks=True, trim_blocks=True
        )
        tmpl = env.from_string(
            """\
    <!-- I'm a comment, I'm not interesting -->
    <? for item in seq ?>
        <?= item ?>
    <? endfor ?>"""
        )
>       assert tmpl.render(seq=range(5)) == "".join(f"        {x}\n" for x in range(5))
E       AssertionError: assert '    \n    \n...      4\n    ' == '        0\n ...\n        4\n'
E         
E         +     
E         +     
E                   0
E         +     
E                   1
E         +     ...
E         
E         ...Full output truncated (6 lines hidden), use '-vv' to show

tests/test_lexnparse.py:839: AssertionError
___________________ TestLstripBlocks.test_php_syntax_compact ___________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d08b280>
env = <jinja2.environment.Environment object at 0x7f5c4c87c220>

    def test_php_syntax_compact(self, env):
        env = Environment(
            "<?", "?>", "<?=", "?>", "<!--", "-->", lstrip_blocks=True, trim_blocks=True
        )
        tmpl = env.from_string(
            """\
    <!-- I'm a comment, I'm not interesting -->
    <?for item in seq?>
        <?=item?>
    <?endfor?>"""
        )
>       assert tmpl.render(seq=range(5)) == "".join(f"        {x}\n" for x in range(5))
E       AssertionError: assert '    \n    \n...      4\n    ' == '        0\n ...\n        4\n'
E         
E         +     
E         +     
E                   0
E         +     
E                   1
E         +     ...
E         
E         ...Full output truncated (6 lines hidden), use '-vv' to show

tests/test_lexnparse.py:852: AssertionError
_______________________ TestLstripBlocks.test_erb_syntax _______________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d08a5c0>
env = <jinja2.environment.Environment object at 0x7f5c4ce7dcc0>

        def test_erb_syntax(self, env):
            env = Environment(
                "<%", "%>", "<%=", "%>", "<%#", "%>", lstrip_blocks=True, trim_blocks=True
            )
            tmpl = env.from_string(
                """\
    <%# I'm a comment, I'm not interesting %>
        <% for item in seq %>
        <%= item %>
        <% endfor %>
    """
            )
>           assert tmpl.render(seq=range(5)) == "".join(f"    {x}\n" for x in range(5))
E           AssertionError: assert '\n    \n    ...\n    4\n    ' == '    0\n    1...   3\n    4\n'
E             
E             + 
E             +     
E                   0
E             +     
E                   1
E             +     ...
E             
E             ...Full output truncated (6 lines hidden), use '-vv' to show

tests/test_lexnparse.py:866: AssertionError
_________________ TestLstripBlocks.test_erb_syntax_with_manual _________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0895d0>
env = <jinja2.environment.Environment object at 0x7f5c4c87c370>

        def test_erb_syntax_with_manual(self, env):
            env = Environment(
                "<%", "%>", "<%=", "%>", "<%#", "%>", lstrip_blocks=True, trim_blocks=True
            )
            tmpl = env.from_string(
                """\
    <%# I'm a comment, I'm not interesting %>
        <% for item in seq -%>
            <%= item %>
        <%- endfor %>"""
            )
>           assert tmpl.render(seq=range(5)) == "01234"
E           AssertionError: assert '\n    \n    ...      4\n    ' == '01234'
E             
E             - 01234
E             + 
E             +     
E             +         0
E             +     
E             +         1...
E             
E             ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_lexnparse.py:879: AssertionError
__________________ TestLstripBlocks.test_erb_syntax_no_lstrip __________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a66e0>
env = <jinja2.environment.Environment object at 0x7f5c4c907f40>

        def test_erb_syntax_no_lstrip(self, env):
            env = Environment(
                "<%", "%>", "<%=", "%>", "<%#", "%>", lstrip_blocks=True, trim_blocks=True
            )
            tmpl = env.from_string(
                """\
    <%# I'm a comment, I'm not interesting %>
        <%+ for item in seq -%>
            <%= item %>
        <%- endfor %>"""
            )
>           assert tmpl.render(seq=range(5)) == "    01234"
E           AssertionError: assert '\n    \n        \n    ' == '    01234'
E             
E             Strings contain only whitespace, escaping them using repr()
E             - '    01234'
E             + '\n    \n        \n    '

tests/test_lexnparse.py:892: AssertionError
_____________________ TestLstripBlocks.test_comment_syntax _____________________

self = <test_lexnparse.TestLstripBlocks object at 0x7f5c4d0a60e0>
env = <jinja2.environment.Environment object at 0x7f5c4c87f430>

        def test_comment_syntax(self, env):
            env = Environment(
                "<!--",
                "-->",
                "${",
                "}",
                "<!--#",
                "-->",
                lstrip_blocks=True,
                trim_blocks=True,
            )
            tmpl = env.from_string(
                """\
    <!--# I'm a comment, I'm not interesting -->\
    <!-- for item in seq --->
        ${item}
    <!--- endfor -->"""
            )
>           assert tmpl.render(seq=range(5)) == "01234"
E           AssertionError: assert '\n    0\n\n ...   3\n\n    4' == '01234'
E             
E             - 01234
E             + 
E             +     0
E             + 
E             +     1
E             + ...
E             
E             ...Full output truncated (5 lines hidden), use '-vv' to show

tests/test_lexnparse.py:912: AssertionError
___________________________ TestTrimBlocks.test_trim ___________________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a5b40>
env = <jinja2.environment.Environment object at 0x7f5c4c904b20>

    def test_trim(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=False)
        tmpl = env.from_string("    {% if True %}\n    {% endif %}")
>       assert tmpl.render() == "        "
E       AssertionError: assert '    \n    ' == '        '
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '        '
E         + '    \n    '
E         ?      ++

tests/test_lexnparse.py:919: AssertionError
_________________________ TestTrimBlocks.test_no_trim __________________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a59f0>
env = <jinja2.environment.Environment object at 0x7f5c4c87d570>

    def test_no_trim(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=False)
        tmpl = env.from_string("    {% if True +%}\n    {% endif %}")
>       assert tmpl.render() == "    \n    "

tests/test_lexnparse.py:924: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'True +'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c87d570>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           True +
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
______________________ TestTrimBlocks.test_lstrip_no_trim ______________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a4cd0>
env = <jinja2.environment.Environment object at 0x7f5c4cc3b880>

    def test_lstrip_no_trim(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string("    {% if True +%}\n    {% endif %}")
>       assert tmpl.render() == "\n"

tests/test_lexnparse.py:934: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'True +'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cc3b880>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           True +
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
______________ TestTrimBlocks.test_trim_blocks_false_with_no_trim ______________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a4f40>
env = <jinja2.environment.Environment object at 0x7f5c4cabe200>

    def test_trim_blocks_false_with_no_trim(self, env):
        # Test that + is a NOP (but does not cause an error) if trim_blocks=False
        env = Environment(trim_blocks=False, lstrip_blocks=False)
        tmpl = env.from_string("    {% if True %}\n    {% endif %}")
        assert tmpl.render() == "    \n    "
        tmpl = env.from_string("    {% if True +%}\n    {% endif %}")
>       assert tmpl.render() == "    \n    "

tests/test_lexnparse.py:942: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'True +'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cabe200>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           True +
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_______________________ TestTrimBlocks.test_trim_nested ________________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a6e60>
env = <jinja2.environment.Environment object at 0x7f5c4d043550>

    def test_trim_nested(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string(
            "    {% if True %}\na {% if True %}\nb {% endif %}\nc {% endif %}"
        )
>       assert tmpl.render() == "a b c "
E       AssertionError: assert '    \na \nb \nc ' == 'a b c '
E         
E         - a b c 
E         +     
E         + a 
E         + b 
E         + c

tests/test_lexnparse.py:959: AssertionError
______________________ TestTrimBlocks.test_no_trim_nested ______________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a7190>
env = <jinja2.environment.Environment object at 0x7f5c4c907760>

    def test_no_trim_nested(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string(
            "    {% if True +%}\na {% if True +%}\nb {% endif +%}\nc {% endif %}"
        )
>       assert tmpl.render() == "\na \nb \nc "

tests/test_lexnparse.py:966: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:955: in _render_tokens
    body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'True +'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c907760>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           True +
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_______________________ TestTrimBlocks.test_comment_trim _______________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a74c0>
env = <jinja2.environment.Environment object at 0x7f5c4c945180>

    def test_comment_trim(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string("""    {# comment #}\n\n  """)
>       assert tmpl.render() == "\n  "
E       AssertionError: assert '    \n\n  ' == '\n  '
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '\n  '
E         + '    \n\n  '

tests/test_lexnparse.py:971: AssertionError
_____________________ TestTrimBlocks.test_comment_no_trim ______________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a77f0>
env = <jinja2.environment.Environment object at 0x7f5c4c942ad0>

    def test_comment_no_trim(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string("""    {# comment +#}\n\n  """)
>       assert tmpl.render() == "\n\n  "
E       AssertionError: assert '    \n\n  ' == '\n\n  '
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '\n\n  '
E         + '    \n\n  '
E         ?  ++++

tests/test_lexnparse.py:976: AssertionError
_______________ TestTrimBlocks.test_multiple_comment_trim_lstrip _______________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d089450>
env = <jinja2.environment.Environment object at 0x7f5c4c944130>

    def test_multiple_comment_trim_lstrip(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string(
            "   {# comment #}\n\n{# comment2 #}\n   \n{# comment3 #}\n\n "
        )
>       assert tmpl.render() == "\n   \n\n "
E       AssertionError: assert '   \n\n\n   \n\n\n ' == '\n   \n\n '
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '\n   \n\n '
E         + '   \n\n\n   \n\n\n '

tests/test_lexnparse.py:983: AssertionError
_____________ TestTrimBlocks.test_multiple_comment_no_trim_lstrip ______________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d08b8e0>
env = <jinja2.environment.Environment object at 0x7f5c4c9434f0>

    def test_multiple_comment_no_trim_lstrip(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string(
            "   {# comment +#}\n\n{# comment2 +#}\n   \n{# comment3 +#}\n\n "
        )
>       assert tmpl.render() == "\n\n\n   \n\n\n "
E       AssertionError: assert '   \n\n\n   \n\n\n ' == '\n\n\n   \n\n\n '
E         
E         Strings contain only whitespace, escaping them using repr()
E         - '\n\n\n   \n\n\n '
E         + '   \n\n\n   \n\n\n '
E         ?  +++

tests/test_lexnparse.py:990: AssertionError
_____________________ TestTrimBlocks.test_raw_trim_lstrip ______________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a75b0>
env = <jinja2.environment.Environment object at 0x7f5c4c8ce8c0>

    def test_raw_trim_lstrip(self, env):
        env = Environment(trim_blocks=True, lstrip_blocks=True)
        tmpl = env.from_string("{{x}}{% raw %}\n\n    {% endraw %}\n\n{{ y }}")
>       assert tmpl.render(x=1, y=2) == "1\n\n\n2"
E       AssertionError: assert '1\n\n    ' == '1\n\n\n2'
E         
E           1
E           
E         +     
E         - 
E         - 2

tests/test_lexnparse.py:995: AssertionError
____________________ TestTrimBlocks.test_raw_no_trim_lstrip ____________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a70a0>
env = <jinja2.environment.Environment object at 0x7f5c4c9423b0>

    def test_raw_no_trim_lstrip(self, env):
        env = Environment(trim_blocks=False, lstrip_blocks=True)
        tmpl = env.from_string("{{x}}{% raw %}\n\n      {% endraw +%}\n\n{{ y }}")
>       assert tmpl.render(x=1, y=2) == "1\n\n\n\n2"
E       AssertionError: assert '1\n\n      ' == '1\n\n\n\n2'
E         
E           1
E           
E         +       
E         - 
E         - 
E         - 2

tests/test_lexnparse.py:1000: AssertionError
__________________ TestTrimBlocks.test_no_trim_angle_bracket ___________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a48e0>
env = <jinja2.environment.Environment object at 0x7f5c4c8cfa90>

    def test_no_trim_angle_bracket(self, env):
        env = Environment(
            "<%", "%>", "${", "}", "<%#", "%>", lstrip_blocks=True, trim_blocks=True
        )
        tmpl = env.from_string("    <% if True +%>\n\n    <% endif %>")
>       assert tmpl.render() == "\n\n"

tests/test_lexnparse.py:1011: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'True +'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c8cfa90>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           True +
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
____________________ TestTrimBlocks.test_no_trim_php_syntax ____________________

self = <test_lexnparse.TestTrimBlocks object at 0x7f5c4d0a5570>
env = <jinja2.environment.Environment object at 0x7f5c4c944ee0>

    def test_no_trim_php_syntax(self, env):
        env = Environment(
            "<?",
            "?>",
            "<?=",
            "?>",
            "<!--",
            "-->",
            lstrip_blocks=False,
            trim_blocks=True,
        )
        tmpl = env.from_string("    <? if True +?>\n\n    <? endif ?>")
>       assert tmpl.render() == "    \n\n    "

tests/test_lexnparse.py:1028: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'True +'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c944ee0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           True +
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_________________________ TestLoaders.test_dict_loader _________________________

self = <test_loader.TestLoaders object at 0x7f5c4d0e1a80>
dict_loader = <jinja2.loaders.DictLoader object at 0x7f5c4d0423b0>

    def test_dict_loader(self, dict_loader):
        env = Environment(loader=dict_loader)
        tmpl = env.get_template("justdict.html")
>       assert tmpl.render().strip() == "FOO"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:26: AttributeError
_______________________ TestLoaders.test_package_loader ________________________

self = <test_loader.TestLoaders object at 0x7f5c4d0e1d50>
package_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4c9410c0>

    def test_package_loader(self, package_loader):
        env = Environment(loader=package_loader)
        tmpl = env.get_template("test.html")
>       assert tmpl.render().strip() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:32: AttributeError
________________________ TestLoaders.test_choice_loader ________________________

self = <test_loader.TestLoaders object at 0x7f5c4d0e23b0>
choice_loader = <jinja2.loaders.ChoiceLoader object at 0x7f5c4cabee90>

    def test_choice_loader(self, choice_loader):
        env = Environment(loader=choice_loader)
        tmpl = env.get_template("justdict.html")
>       assert tmpl.render().strip() == "FOO"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:47: AttributeError
_______________________ TestLoaders.test_function_loader _______________________

self = <test_loader.TestLoaders object at 0x7f5c4d0e26e0>
function_loader = <jinja2.loaders.FunctionLoader object at 0x7f5c4ce4a650>

    def test_function_loader(self, function_loader):
        env = Environment(loader=function_loader)
        tmpl = env.get_template("justfunction.html")
>       assert tmpl.render().strip() == "FOO"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:55: AttributeError
________________________ TestLoaders.test_prefix_loader ________________________

self = <test_loader.TestLoaders object at 0x7f5c4d0e2a70>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4cabe050>

    def test_prefix_loader(self, prefix_loader):
        env = Environment(loader=prefix_loader)
        tmpl = env.get_template("a/test.html")
>       assert tmpl.render().strip() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:61: AttributeError
___________________________ TestLoaders.test_caching ___________________________

self = <test_loader.TestLoaders object at 0x7f5c4d0e2da0>

    def test_caching(self):
        changed = False
    
        class TestLoader(loaders.BaseLoader):
            def get_source(self, environment, template):
                return "foo", None, lambda: not changed
    
        env = Environment(loader=TestLoader(), cache_size=-1)
        tmpl = env.get_template("template")
        assert tmpl is env.get_template("template")
        changed = True
>       assert tmpl is not env.get_template("template")
E       AssertionError: assert None is not None
E        +  where None = get_template('template')
E        +    where get_template = <jinja2.environment.Environment object at 0x7f5c4caf7ca0>.get_template

tests/test_loader.py:77: AssertionError
__________________________ TestLoaders.test_no_cache ___________________________

self = <test_loader.TestLoaders object at 0x7f5c4d0a79a0>

    def test_no_cache(self):
        mapping = {"foo": "one"}
        env = Environment(loader=loaders.DictLoader(mapping), cache_size=0)
>       assert env.get_template("foo") is not env.get_template("foo")
E       AssertionError: assert None is not None
E        +  where None = get_template('foo')
E        +    where get_template = <jinja2.environment.Environment object at 0x7f5c4cabf100>.get_template
E        +  and   None = get_template('foo')
E        +    where get_template = <jinja2.environment.Environment object at 0x7f5c4cabf100>.get_template

tests/test_loader.py:83: AssertionError
_____________________ TestLoaders.test_limited_size_cache ______________________

self = <test_loader.TestLoaders object at 0x7f5c4d0a6920>

    def test_limited_size_cache(self):
        mapping = {"one": "foo", "two": "bar", "three": "baz"}
        loader = loaders.DictLoader(mapping)
        env = Environment(loader=loader, cache_size=2)
        t1 = env.get_template("one")
        t2 = env.get_template("two")
        assert t2 is env.get_template("two")
        assert t1 is env.get_template("one")
        env.get_template("three")
        loader_ref = weakref.ref(loader)
>       assert (loader_ref, "one") in env.cache
E       AssertionError: assert (<weakref at 0x7f5c4c7ccfe0; to 'DictLoader' at 0x7f5c4cf26470>, 'one') in <LRUCache {}>
E        +  where <LRUCache {}> = <jinja2.environment.Environment object at 0x7f5c4cf241f0>.cache

tests/test_loader.py:95: AssertionError
_____________________ TestLoaders.test_cache_loader_change _____________________

self = <test_loader.TestLoaders object at 0x7f5c4d088550>

    def test_cache_loader_change(self):
        loader1 = loaders.DictLoader({"foo": "one"})
        loader2 = loaders.DictLoader({"foo": "two"})
        env = Environment(loader=loader1, cache_size=2)
>       assert env.get_template("foo").render() == "one"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:103: AttributeError
________________ TestLoaders.test_dict_loader_cache_invalidates ________________

self = <test_loader.TestLoaders object at 0x7f5c4d264670>

    def test_dict_loader_cache_invalidates(self):
        mapping = {"foo": "one"}
        env = Environment(loader=loaders.DictLoader(mapping))
>       assert env.get_template("foo").render() == "one"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:110: AttributeError
_________________ TestFileSystemLoader.test_searchpath_as_str __________________

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e2920>

    def test_searchpath_as_str(self):
        filesystem_loader = loaders.FileSystemLoader(str(self.searchpath))
    
        env = Environment(loader=filesystem_loader)
>       self._test_common(env)

tests/test_loader.py:135: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

env = <jinja2.environment.Environment object at 0x7f5c4cc3ae00>

    @staticmethod
    def _test_common(env):
        tmpl = env.get_template("test.html")
>       assert tmpl.render().strip() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:126: AttributeError
_______________ TestFileSystemLoader.test_searchpath_as_pathlib ________________

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e2140>

    def test_searchpath_as_pathlib(self):
        filesystem_loader = loaders.FileSystemLoader(self.searchpath)
        env = Environment(loader=filesystem_loader)
>       self._test_common(env)

tests/test_loader.py:140: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

env = <jinja2.environment.Environment object at 0x7f5c4d041030>

    @staticmethod
    def _test_common(env):
        tmpl = env.get_template("test.html")
>       assert tmpl.render().strip() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:126: AttributeError
________ TestFileSystemLoader.test_searchpath_as_list_including_pathlib ________

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e1f60>

    def test_searchpath_as_list_including_pathlib(self):
        filesystem_loader = loaders.FileSystemLoader(
            ["/tmp/templates", self.searchpath]
        )
        env = Environment(loader=filesystem_loader)
>       self._test_common(env)

tests/test_loader.py:147: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

env = <jinja2.environment.Environment object at 0x7f5c4d058cd0>

    @staticmethod
    def _test_common(env):
        tmpl = env.get_template("test.html")
>       assert tmpl.render().strip() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:126: AttributeError
___________ TestFileSystemLoader.test_caches_template_based_on_mtime ___________

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e18d0>

    def test_caches_template_based_on_mtime(self):
        filesystem_loader = loaders.FileSystemLoader(self.searchpath)
    
        env = Environment(loader=filesystem_loader)
        tmpl1 = env.get_template("test.html")
        tmpl2 = env.get_template("test.html")
        assert tmpl1 is tmpl2
    
        os.utime(self.searchpath / "test.html", (time.time(), time.time()))
        tmpl3 = env.get_template("test.html")
>       assert tmpl1 is not tmpl3
E       assert None is not None

tests/test_loader.py:159: AssertionError
_ TestFileSystemLoader.test_uses_specified_encoding[utf-8-\u6587\u5b57\u5316\u3051] _

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e1660>
encoding = 'utf-8', expect = '文字化け'

    @pytest.mark.parametrize(
        ("encoding", "expect"),
        [
            ("utf-8", "文字化け"),
            ("iso-8859-1", "æ\x96\x87\xe5\xad\x97\xe5\x8c\x96\xe3\x81\x91"),
        ],
    )
    def test_uses_specified_encoding(self, encoding, expect):
        loader = loaders.FileSystemLoader(self.searchpath, encoding=encoding)
        e = Environment(loader=loader)
        t = e.get_template("mojibake.txt")
>       assert t.render() == expect
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:172: AttributeError
_ TestFileSystemLoader.test_uses_specified_encoding[iso-8859-1-\xe6\x96\x87\xe5\xad\x97\xe5\x8c\x96\xe3\x81\x91] _

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e0df0>
encoding = 'iso-8859-1', expect = 'æ\x96\x87å\xad\x97å\x8c\x96ã\x81\x91'

    @pytest.mark.parametrize(
        ("encoding", "expect"),
        [
            ("utf-8", "文字化け"),
            ("iso-8859-1", "æ\x96\x87\xe5\xad\x97\xe5\x8c\x96\xe3\x81\x91"),
        ],
    )
    def test_uses_specified_encoding(self, encoding, expect):
        loader = loaders.FileSystemLoader(self.searchpath, encoding=encoding)
        e = Environment(loader=loader)
        t = e.get_template("mojibake.txt")
>       assert t.render() == expect
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:172: AttributeError
_________________ TestFileSystemLoader.test_filename_normpath __________________

self = <test_loader.TestFileSystemLoader object at 0x7f5c4d0e3070>

    def test_filename_normpath(self):
        """Nested template names should only contain ``os.sep`` in the
        loaded filename.
        """
        loader = loaders.FileSystemLoader(self.searchpath)
        e = Environment(loader=loader)
        t = e.get_template("foo/test.html")
>       assert t.filename == str(self.searchpath / "foo" / "test.html")
E       AttributeError: 'NoneType' object has no attribute 'filename'

tests/test_loader.py:181: AttributeError
__________________________ TestModuleLoader.test_log ___________________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e35b0>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4c9401c0>

    def test_log(self, prefix_loader):
        log = self.compile_down(prefix_loader)
>       assert (
            'Compiled "a/foo/test.html" as '
            "tmpl_a790caf9d669e39ea4d280d597ec891c4ef0404a" in log
        )
E       assert 'Compiled "a/foo/test.html" as tmpl_a790caf9d669e39ea4d280d597ec891c4ef0404a' in ''

tests/test_loader.py:211: AssertionError
__________________ TestModuleLoader.test_deflated_zip_compile __________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e3910>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4cac4730>

    def test_deflated_zip_compile(self, prefix_loader):
        self.compile_down(prefix_loader, zip="deflated")
>       self._test_common()

tests/test_loader.py:232: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e3910>

    def _test_common(self):
        tmpl1 = self.reg_env.get_template("a/test.html")
        tmpl2 = self.mod_env.get_template("a/test.html")
>       assert tmpl1.render() == tmpl2.render()
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:224: AttributeError
___________________ TestModuleLoader.test_stored_zip_compile ___________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e3c70>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4c905d50>

    def test_stored_zip_compile(self, prefix_loader):
        self.compile_down(prefix_loader, zip="stored")
>       self._test_common()

tests/test_loader.py:236: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e3c70>

    def _test_common(self):
        tmpl1 = self.reg_env.get_template("a/test.html")
        tmpl2 = self.mod_env.get_template("a/test.html")
>       assert tmpl1.render() == tmpl2.render()
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:224: AttributeError
___________________ TestModuleLoader.test_filesystem_compile ___________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d100040>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4cac6260>

    def test_filesystem_compile(self, prefix_loader):
        self.compile_down(prefix_loader, zip=None)
>       self._test_common()

tests/test_loader.py:240: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <test_loader.TestModuleLoader object at 0x7f5c4d100040>

    def _test_common(self):
        tmpl1 = self.reg_env.get_template("a/test.html")
        tmpl2 = self.mod_env.get_template("a/test.html")
>       assert tmpl1.render() == tmpl2.render()
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:224: AttributeError
____________________ TestModuleLoader.test_weak_references _____________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e3a30>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4cbdb700>

    def test_weak_references(self, prefix_loader):
        self.compile_down(prefix_loader)
        self.mod_env.get_template("a/test.html")
>       key = loaders.ModuleLoader.get_template_key("a/test.html")
E       AttributeError: type object 'ModuleLoader' has no attribute 'get_template_key'

tests/test_loader.py:245: AttributeError
_____________________ TestModuleLoader.test_choice_loader ______________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e36a0>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4cac5690>

    def test_choice_loader(self, prefix_loader):
        self.compile_down(prefix_loader)
        self.mod_env.loader = loaders.ChoiceLoader(
            [self.mod_env.loader, loaders.DictLoader({"DICT_SOURCE": "DICT_TEMPLATE"})]
        )
        tmpl1 = self.mod_env.get_template("a/test.html")
>       assert tmpl1.render() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:269: AttributeError
_____________________ TestModuleLoader.test_prefix_loader ______________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e10c0>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4cf59510>

    def test_prefix_loader(self, prefix_loader):
        self.compile_down(prefix_loader)
        self.mod_env.loader = loaders.PrefixLoader(
            {
                "MOD": self.mod_env.loader,
                "DICT": loaders.DictLoader({"test.html": "DICT_TEMPLATE"}),
            }
        )
        tmpl1 = self.mod_env.get_template("MOD/a/test.html")
>       assert tmpl1.render() == "BAR"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_loader.py:282: AttributeError
____________________ TestModuleLoader.test_path_as_pathlib _____________________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e1c90>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4c8cd9f0>

    def test_path_as_pathlib(self, prefix_loader):
        self.compile_down(prefix_loader)
    
>       mod_path = self.mod_env.loader.module.__path__[0]
E       AttributeError: 'ModuleLoader' object has no attribute 'module'

tests/test_loader.py:289: AttributeError
___________ TestModuleLoader.test_supports_pathlib_in_list_of_paths ____________

self = <test_loader.TestModuleLoader object at 0x7f5c4d0e2560>
prefix_loader = <jinja2.loaders.PrefixLoader object at 0x7f5c4ce3ba00>

    def test_supports_pathlib_in_list_of_paths(self, prefix_loader):
        self.compile_down(prefix_loader)
    
>       mod_path = self.mod_env.loader.module.__path__[0]
E       AttributeError: 'ModuleLoader' object has no attribute 'module'

tests/test_loader.py:298: AttributeError
__________________ test_package_zip_source[foo/test.html-FOO] __________________

package_zip_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4c8cd9c0>
template = 'foo/test.html', expect = 'FOO'

    @pytest.mark.parametrize(
        ("template", "expect"), [("foo/test.html", "FOO"), ("test.html", "BAR")]
    )
    def test_package_zip_source(package_zip_loader, template, expect):
>       source, name, up_to_date = package_zip_loader.get_source(None, template)

tests/test_loader.py:360: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/loaders.py:88: in get_source
    return self._loader.get_source(environment, template)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.loaders.FileSystemLoader object at 0x7f5c4c8cfd60>
environment = None, template = 'foo/test.html'

    def get_source(self, environment: 'Environment', template: str):
        pieces = split_template_path(template)
        for searchpath in self.searchpath:
            filename = os.path.join(searchpath, *pieces)
            if os.path.isfile(filename):
                break
        else:
>           raise TemplateNotFound(template)
E           jinja2.exceptions.TemplateNotFound: foo/test.html

src/jinja2/loaders.py:60: TemplateNotFound
____________________ test_package_zip_source[test.html-BAR] ____________________

package_zip_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4d0a4a30>
template = 'test.html', expect = 'BAR'

    @pytest.mark.parametrize(
        ("template", "expect"), [("foo/test.html", "FOO"), ("test.html", "BAR")]
    )
    def test_package_zip_source(package_zip_loader, template, expect):
>       source, name, up_to_date = package_zip_loader.get_source(None, template)

tests/test_loader.py:360: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/loaders.py:88: in get_source
    return self._loader.get_source(environment, template)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.loaders.FileSystemLoader object at 0x7f5c4d0a6bf0>
environment = None, template = 'test.html'

    def get_source(self, environment: 'Environment', template: str):
        pieces = split_template_path(template)
        for searchpath in self.searchpath:
            filename = os.path.join(searchpath, *pieces)
            if os.path.isfile(filename):
                break
        else:
>           raise TemplateNotFound(template)
E           jinja2.exceptions.TemplateNotFound: test.html

src/jinja2/loaders.py:60: TemplateNotFound
____________________________ test_package_zip_list _____________________________

package_zip_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4d0423b0>

    @pytest.mark.xfail(
        platform.python_implementation() == "PyPy",
        reason="PyPy's zipimporter doesn't have a '_files' attribute.",
        raises=TypeError,
    )
    def test_package_zip_list(package_zip_loader):
>       assert package_zip_loader.list_templates() == ["foo/test.html", "test.html"]
E       AssertionError: assert [] == ['foo/test.html', 'test.html']
E         
E         Right contains 2 more items, first extra item: 'foo/test.html'
E         Use -v to get more diff

tests/test_loader.py:372: AssertionError
________________________ test_package_zip_omit_curdir[] ________________________

package_zip_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4d0a7880>
package_path = ''

    @pytest.mark.parametrize("package_path", ["", ".", "./"])
    def test_package_zip_omit_curdir(package_zip_loader, package_path):
        """PackageLoader should not add or include "." or "./" in the root
        path, it is invalid in zip paths.
        """
        loader = PackageLoader("t_pack", package_path)
        assert loader.package_path == ""
>       source, _, _ = loader.get_source(None, "templates/foo/test.html")

tests/test_loader.py:382: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/loaders.py:88: in get_source
    return self._loader.get_source(environment, template)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.loaders.FileSystemLoader object at 0x7f5c4cc3a8c0>
environment = None, template = 'templates/foo/test.html'

    def get_source(self, environment: 'Environment', template: str):
        pieces = split_template_path(template)
        for searchpath in self.searchpath:
            filename = os.path.join(searchpath, *pieces)
            if os.path.isfile(filename):
                break
        else:
>           raise TemplateNotFound(template)
E           jinja2.exceptions.TemplateNotFound: templates/foo/test.html

src/jinja2/loaders.py:60: TemplateNotFound
_______________________ test_package_zip_omit_curdir[.] ________________________

package_zip_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4cbd58a0>
package_path = '.'

    @pytest.mark.parametrize("package_path", ["", ".", "./"])
    def test_package_zip_omit_curdir(package_zip_loader, package_path):
        """PackageLoader should not add or include "." or "./" in the root
        path, it is invalid in zip paths.
        """
        loader = PackageLoader("t_pack", package_path)
>       assert loader.package_path == ""
E       AssertionError: assert '.' == ''
E         
E         + .

tests/test_loader.py:381: AssertionError
_______________________ test_package_zip_omit_curdir[./] _______________________

package_zip_loader = <jinja2.loaders.PackageLoader object at 0x7f5c4cc3a620>
package_path = './'

    @pytest.mark.parametrize("package_path", ["", ".", "./"])
    def test_package_zip_omit_curdir(package_zip_loader, package_path):
        """PackageLoader should not add or include "." or "./" in the root
        path, it is invalid in zip paths.
        """
        loader = PackageLoader("t_pack", package_path)
>       assert loader.package_path == ""
E       AssertionError: assert './' == ''
E         
E         + ./

tests/test_loader.py:381: AssertionError
_________________________ test_undefined_native_return _________________________

env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4cbd5120>

    def test_undefined_native_return(env):
        t = env.from_string("{{ missing }}")
>       assert isinstance(t.render(), Undefined)
E       AssertionError: assert False
E        +  where False = isinstance('', Undefined)
E        +    where '' = render()
E        +      where render = <NativeTemplate memory:7f5c4cbd6dd0>.render

tests/test_nativetypes.py:23: AssertionError
____________________ test_booleans[{{ None is none }}-True] ____________________

env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4cc394b0>
source = '{{ None is none }}', expect = True

    @pytest.mark.parametrize(
        ("source", "expect"),
        (
            ("{{ value }}", True),
            ("{{ value }}", False),
            ("{{ 1 == 1 }}", True),
            ("{{ 2 + 2 == 5 }}", False),
            ("{{ None is none }}", True),
            ("{{ '' == None }}", False),
        ),
    )
    def test_booleans(env, source, expect):
        t = env.from_string(source)
>       result = t.render(value=expect)

tests/test_nativetypes.py:88: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/nativetypes.py:25: in render
    return native_concat([super().render(*args,**kwargs)])
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4cc394b0>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'None', value = None, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...cler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'value': True} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'None'

src/jinja2/environment.py:1019: KeyError
_____________________________ test_variable_dunder _____________________________

env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4cc3ab00>

    def test_variable_dunder(env):
        t = env.from_string("{{ x.__class__ }}")
        result = t.render(x=True)
>       assert isinstance(result, type)
E       assert False
E        +  where False = isinstance("<class 'bool'>", type)

tests/test_nativetypes.py:96: AssertionError
_____________________________ test_constant_dunder _____________________________

env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4c87d1b0>

    def test_constant_dunder(env):
        t = env.from_string("{{ true.__class__ }}")
        result = t.render()
>       assert isinstance(result, type)
E       assert False
E        +  where False = isinstance("<class 'bool'>", type)

tests/test_nativetypes.py:102: AssertionError
__________________________________ test_macro __________________________________

env = <jinja2.nativetypes.NativeEnvironment object at 0x7f5c4c8377f0>

    def test_macro(env):
        t = env.from_string("{%- macro x() -%}{{- [1,2] -}}{%- endmacro -%}{{- x()[1] -}}")
        result = t.render()
>       assert result == 2
E       assert [1, 2] == 2

tests/test_nativetypes.py:161: AssertionError
_______________________ TestCorner.test_assigned_scoping _______________________

self = <test_regression.TestCorner object at 0x7f5c4d103400>
env = <jinja2.environment.Environment object at 0x7f5c4d04ca90>

    def test_assigned_scoping(self, env):
        t = env.from_string(
            """
        {%- for item in (1, 2, 3, 4) -%}
            [{{ item }}]
        {%- endfor %}
        {{- item -}}
        """
        )
>       assert t.render(item=42) == "[1][2][3][4]42"
E       AssertionError: assert '\n        \n... 42\n        ' == '[1][2][3][4]42'
E         
E         - [1][2][3][4]42
E         + 
E         +         
E         +             [1]
E         +         
E         +             [2]...
E         
E         ...Full output truncated (7 lines hidden), use '-vv' to show

tests/test_regression.py:23: AssertionError
_______________________ TestCorner.test_closure_scoping ________________________

self = <test_regression.TestCorner object at 0x7f5c4d1036d0>
env = <jinja2.environment.Environment object at 0x7f5c4ca3d3f0>

    def test_closure_scoping(self, env):
        t = env.from_string(
            """
        {%- set wrapper = "<FOO>" %}
        {%- for item in (1, 2, 3, 4) %}
            {%- macro wrapper() %}[{{ item }}]{% endmacro %}
            {{- wrapper() }}
        {%- endfor %}
        {{- wrapper -}}
        """
        )
>       assert t.render() == "[1][2][3][4]<FOO>"

tests/test_regression.py:58: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: 'str' object is not callable

<string>:1: TypeError
_______________________ TestBug.test_extends_output_bugs _______________________

self = <test_regression.TestBug object at 0x7f5c4d103d00>
env = <jinja2.environment.Environment object at 0x7f5c4c981a80>

    def test_extends_output_bugs(self, env):
        env = Environment(
            loader=DictLoader({"parent.html": "(({% block title %}{% endblock %}))"})
        )
    
        t = env.from_string(
            '{% if expr %}{% extends "parent.html" %}{% endif %}'
            "[[{% block title %}title{% endblock %}]]"
            "{% for item in [1, 2, 3] %}({{ item }}){% endfor %}"
        )
>       assert t.render(expr=False) == "[[title]](1)(2)(3)"
E       AssertionError: assert '[[title' == '[[title]](1)(2)(3)'
E         
E         - [[title]](1)(2)(3)
E         + [[title

tests/test_regression.py:103: AssertionError
_________________________ TestBug.test_loop_call_loop __________________________

self = <test_regression.TestBug object at 0x7f5c4d103b50>
env = <jinja2.environment.Environment object at 0x7f5c4c7bc460>

    def test_loop_call_loop(self, env):
        tmpl = env.from_string(
            """
    
        {% macro test() %}
            {{ caller() }}
        {% endmacro %}
    
        {% for num1 in range(5) %}
            {% call test() %}
                {% for num2 in range(10) %}
                    {{ loop.index }}
                {% endfor %}
            {% endcall %}
        {% endfor %}
    
        """
        )
    
>       assert tmpl.render().split() == [str(x) for x in range(1, 11)] * 5

tests/test_regression.py:141: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'caller' is undefined

src/jinja2/runtime.py:551: UndefinedError
______________________ TestBug.test_weird_inline_comment _______________________

self = <test_regression.TestBug object at 0x7f5c4d103a00>
env = <jinja2.environment.Environment object at 0x7f5c4cf5abc0>

    def test_weird_inline_comment(self, env):
        env = Environment(line_statement_prefix="%")
>       pytest.raises(
            TemplateSyntaxError,
            env.from_string,
            "% for item in seq {# missing #}\n...% endfor",
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_regression.py:145: Failed
_________________ TestBug.test_partial_conditional_assignments _________________

self = <test_regression.TestBug object at 0x7f5c4d102530>
env = <jinja2.environment.Environment object at 0x7f5c4c940a30>

    def test_partial_conditional_assignments(self, env):
        tmpl = env.from_string("{% if b %}{% set a = 42 %}{% endif %}{{ a }}")
>       assert tmpl.render(a=23) == "23"
E       AssertionError: assert '42' == '23'
E         
E         - 23
E         + 42

tests/test_regression.py:160: AssertionError
___________________ TestBug.test_stacked_locals_scoping_bug ____________________

self = <test_regression.TestBug object at 0x7f5c4d13c130>
env = <jinja2.environment.Environment object at 0x7f5c4cc3ab00>

        def test_stacked_locals_scoping_bug(self, env):
            env = Environment(line_statement_prefix="#")
            t = env.from_string(
                """\
    # for j in [1, 2]:
    #   set x = 1
    #   for i in [1, 2]:
    #     print x
    #     if i % 2 == 0:
    #       set x = x + 1
    #     endif
    #   endfor
    # endfor
    # if a
    #   print 'A'
    # elif b
    #   print 'B'
    # elif c == d
    #   print 'C'
    # else
    #   print 'D'
    # endif
        """
            )
>           assert t.render(a=0, b=False, c=42, d=42.0) == "1111C"
E           assert "# for j in [...# endif\n    " == '1111C'
E             
E             - 1111C
E             + # for j in [1, 2]:
E             + #   set x = 1
E             + #   for i in [1, 2]:
E             + #     print x
E             + #     if i % 2 == 0:...
E             
E             ...Full output truncated (14 lines hidden), use '-vv' to show

tests/test_regression.py:187: AssertionError
_______________ TestBug.test_stacked_locals_scoping_bug_twoframe _______________

self = <test_regression.TestBug object at 0x7f5c4d13c790>
env = <jinja2.environment.Environment object at 0x7f5c4cbd8ac0>

    def test_stacked_locals_scoping_bug_twoframe(self, env):
        t = Template(
            """
            {% set x = 1 %}
            {% for item in foo %}
                {% if item == 1 %}
                    {% set x = 2 %}
                {% endif %}
            {% endfor %}
            {{ x }}
        """
        )
        rv = t.render(foo=[1]).strip()
>       assert rv == "1"
E       AssertionError: assert '2' == '1'
E         
E         - 1
E         + 2

tests/test_regression.py:202: AssertionError
_________________________ TestBug.test_call_with_args __________________________

self = <test_regression.TestBug object at 0x7f5c4d13cac0>
env = <jinja2.environment.Environment object at 0x7f5c4d042380>

    def test_call_with_args(self, env):
        t = Template(
            """{% macro dump_users(users) -%}
        <ul>
          {%- for user in users -%}
            <li><p>{{ user.username|e }}</p>{{ caller(user) }}</li>
          {%- endfor -%}
          </ul>
        {%- endmacro -%}
    
        {% call(user) dump_users(list_of_user) -%}
          <dl>
            <dl>Realname</dl>
            <dd>{{ user.realname|e }}</dd>
            <dl>Description</dl>
            <dd>{{ user.description }}</dd>
          </dl>
        {% endcall %}"""
        )
    
        assert [
            x.strip()
>           for x in t.render(
                list_of_user=[
                    {
                        "username": "apo",
                        "realname": "something else",
                        "description": "test",
                    }
                ]
            ).splitlines()
        ] == [
            "<ul><li><p>apo</p><dl>",
            "<dl>Realname</dl>",
            "<dd>something else</dd>",
            "<dl>Description</dl>",
            "<dd>test</dd>",
            "</dl>",
            "</li></ul>",
        ]

tests/test_regression.py:226: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'user' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestBug.test_empty_if_condition_fails _____________________

self = <test_regression.TestBug object at 0x7f5c4d13cdf0>
env = <jinja2.environment.Environment object at 0x7f5c4ce4f2e0>

    def test_empty_if_condition_fails(self, env):
>       pytest.raises(TemplateSyntaxError, Template, "{% if %}....{% endif %}")
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_regression.py:246: Failed
__________________________ TestBug.test_else_loop_bug __________________________

self = <test_regression.TestBug object at 0x7f5c4d13d450>
env = <jinja2.environment.Environment object at 0x7f5c4ca6ab30>

    def test_else_loop_bug(self, env):
        t = Template(
            """
            {% for x in y %}
                {{ loop.index0 }}
            {% else %}
                {% for i in range(3) %}{{ i }}{% endfor %}
            {% endfor %}
        """
        )
>       assert t.render(y=[]).strip() == "012"

tests/test_regression.py:292: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________ TestBug.test_correct_prefix_loader_name ____________________

self = <test_regression.TestBug object at 0x7f5c4d13d780>
env = <jinja2.environment.Environment object at 0x7f5c4c8cf7f0>

    def test_correct_prefix_loader_name(self, env):
        env = Environment(loader=PrefixLoader({"foo": DictLoader({})}))
>       with pytest.raises(TemplateNotFound) as e:
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateNotFound'>

tests/test_regression.py:296: Failed
___________________ TestBug.test_pass_context_callable_class ___________________

self = <test_regression.TestBug object at 0x7f5c4d13dab0>
env = <jinja2.environment.Environment object at 0x7f5c4c7bcd90>

    def test_pass_context_callable_class(self, env):
        class CallableClass:
            @pass_context
            def __call__(self, ctx):
                return ctx.resolve("hello")
    
        tpl = Template("""{{ callableclass() }}""")
>       output = tpl.render(callableclass=CallableClass(), hello="TEST")

tests/test_regression.py:308: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: TestBug.test_pass_context_callable_class.<locals>.CallableClass.__call__() missing 1 required positional argument: 'ctx'

<string>:1: TypeError
_____________________ TestBug.test_block_set_with_extends ______________________

self = <test_regression.TestBug object at 0x7f5c4d13dde0>

    def test_block_set_with_extends(self):
        env = Environment(
            loader=DictLoader({"main": "{% block body %}[{{ x }}]{% endblock %}"})
        )
        t = env.from_string('{% extends "main" %}{% set x %}42{% endset %}')
>       assert t.render() == "[42]"
E       AssertionError: assert '42' == '[42]'
E         
E         - [42]
E         + 42

tests/test_regression.py:318: AssertionError
_________________________ TestBug.test_nested_for_else _________________________

self = <test_regression.TestBug object at 0x7f5c4d13e0b0>
env = <jinja2.environment.Environment object at 0x7f5c4cf26050>

    def test_nested_for_else(self, env):
        tmpl = env.from_string(
            "{% for x in y %}{{ loop.index0 }}{% else %}"
            "{% for i in range(3) %}{{ i }}{% endfor %}"
            "{% endfor %}"
        )
>       assert tmpl.render() == "012"

tests/test_regression.py:326: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestBug.test_callable_defaults ________________________

self = <test_regression.TestBug object at 0x7f5c4d103850>

    def test_callable_defaults(self):
        env = Environment()
        env.globals["get_int"] = lambda: 42
        t = env.from_string(
            """
        {% macro test(a, b, c=get_int()) -%}
             {{ a + b + c }}
        {%- endmacro %}
        {{ test(1, 2) }}|{{ test(1, 2, 3) }}
        """
        )
>       assert t.render().strip() == "45|6"

tests/test_regression.py:363: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (Undefined,), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'a' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________________ TestBug.test_macro_scoping __________________________

self = <test_regression.TestBug object at 0x7f5c4d13e590>
env = <jinja2.environment.Environment object at 0x7f5c4cbd6b60>

    def test_macro_scoping(self, env):
        tmpl = env.from_string(
            """
        {% set n=[1,2,3,4,5] %}
        {% for n in [[1,2,3], [3,4,5], [5,6,7]] %}
    
        {% macro x(l) %}
          {{ l.pop() }}
          {% if l %}{{ x(l) }}{% endif %}
        {% endmacro %}
    
        {{ x(n) }}
    
        {% endfor %}
        """
        )
>       assert list(map(int, tmpl.render().split())) == [3, 2, 1, 5, 4, 3, 7, 6, 5]

tests/test_regression.py:387: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'l' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________ TestBug.test_scopes_and_blocks ________________________

self = <test_regression.TestBug object at 0x7f5c4d13de10>

    def test_scopes_and_blocks(self):
        env = Environment(
            loader=DictLoader(
                {
                    "a.html": """
                {%- set foo = 'bar' -%}
                {% include 'x.html' -%}
            """,
                    "b.html": """
                {%- set foo = 'bar' -%}
                {% block test %}{% include 'x.html' %}{% endblock -%}
                """,
                    "c.html": """
                {%- set foo = 'bar' -%}
                {% block test %}{% set foo = foo
                    %}{% include 'x.html' %}{% endblock -%}
            """,
                    "x.html": """{{ foo }}|{{ test }}""",
                }
            )
        )
    
        a = env.get_template("a.html")
        b = env.get_template("b.html")
        c = env.get_template("c.html")
    
>       assert a.render(test="x").strip() == "bar|x"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:415: AttributeError
_______________________ TestBug.test_scopes_and_include ________________________

self = <test_regression.TestBug object at 0x7f5c4d13ddb0>

    def test_scopes_and_include(self):
        env = Environment(
            loader=DictLoader(
                {
                    "include.html": "{{ var }}",
                    "base.html": '{% include "include.html" %}',
                    "child.html": '{% extends "base.html" %}{% set var = 42 %}',
                }
            )
        )
        t = env.get_template("child.html")
>       assert t.render() == "42"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:430: AttributeError
_________________________ TestBug.test_caller_scoping __________________________

self = <test_regression.TestBug object at 0x7f5c4d13d480>
env = <jinja2.environment.Environment object at 0x7f5c4cc39510>

    def test_caller_scoping(self, env):
        t = env.from_string(
            """
        {% macro detail(icon, value) -%}
          {% if value -%}
            <p><span class="fa fa-fw fa-{{ icon }}"></span>
                {%- if caller is undefined -%}
                    {{ value }}
                {%- else -%}
                    {{ caller(value, *varargs) }}
                {%- endif -%}</p>
          {%- endif %}
        {%- endmacro %}
    
    
        {% macro link_detail(icon, value, href) -%}
          {% call(value, href) detail(icon, value, href) -%}
            <a href="{{ href }}">{{ value }}</a>
          {%- endcall %}
        {%- endmacro %}
        """
        )
    
>       assert t.module.link_detail("circle", "Index", "/") == (
            '<p><span class="fa fa-fw fa-circle"></span><a href="/">Index</a></p>'
        )
E       AttributeError: 'NoneType' object has no attribute 'link_detail'

tests/test_regression.py:455: AttributeError
_________________________ TestBug.test_variable_reuse __________________________

self = <test_regression.TestBug object at 0x7f5c4d13d420>
env = <jinja2.environment.Environment object at 0x7f5c4ca3f220>

    def test_variable_reuse(self, env):
        t = env.from_string("{% for x in x.y %}{{ x }}{% endfor %}")
        assert t.render(x={"y": [0, 1, 2]}) == "012"
    
        t = env.from_string("{% for x in x.y %}{{ loop.index0 }}|{{ x }}{% endfor %}")
>       assert t.render(x={"y": [0, 1, 2]}) == "0|01|12|2"

tests/test_regression.py:464: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________________ TestBug.test_double_caller __________________________

self = <test_regression.TestBug object at 0x7f5c4d13cca0>
env = <jinja2.environment.Environment object at 0x7f5c4ca4f0a0>

    def test_double_caller(self, env):
        t = env.from_string(
            "{% macro x(caller=none) %}[{% if caller %}"
            "{{ caller() }}{% endif %}]{% endmacro %}"
            "{{ x() }}{% call x() %}aha!{% endcall %}"
        )
>       assert t.render() == "[][aha!]"

tests/test_regression.py:475: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:955: in _render_tokens
    body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'caller' is undefined

src/jinja2/runtime.py:551: UndefinedError
____________________ TestBug.test_double_caller_no_default _____________________

self = <test_regression.TestBug object at 0x7f5c4d13c5b0>
env = <jinja2.environment.Environment object at 0x7f5c4d103490>

    def test_double_caller_no_default(self, env):
>       with pytest.raises(TemplateAssertionError) as exc_info:
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateAssertionError'>

tests/test_regression.py:478: Failed
__________________________ TestBug.test_scoped_block ___________________________

self = <test_regression.TestBug object at 0x7f5c4d13ead0>
env = <jinja2.environment.Environment object at 0x7f5c4c8cf8b0>

    def test_scoped_block(self, env):
        t = env.from_string(
            "{% set x = 1 %}{% with x = 2 %}{% block y scoped %}"
            "{{ x }}{% endblock %}{% endwith %}"
        )
>       assert t.render() == "2"
E       AssertionError: assert '1' == '2'
E         
E         - 2
E         + 1

tests/test_regression.py:508: AssertionError
______________________ TestBug.test_recursive_loop_filter ______________________

self = <test_regression.TestBug object at 0x7f5c4d13ee00>
env = <jinja2.environment.Environment object at 0x7f5c4ce7fa00>

    def test_recursive_loop_filter(self, env):
        t = env.from_string(
            """
        <?xml version="1.0" encoding="UTF-8"?>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
          {%- for page in [site.root] if page.url != this recursive %}
          <url><loc>{{ page.url }}</loc></url>
          {{- loop(page.children) }}
          {%- endfor %}
        </urlset>
        """
        )
>       sm = t.render(
            this="/foo",
            site={"root": {"url": "/", "children": [{"url": "/foo"}, {"url": "/bar"}]}},
        )

tests/test_regression.py:522: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'page' is undefined

src/jinja2/runtime.py:551: UndefinedError
_________________________ TestBug.test_subproperty_if __________________________

self = <test_regression.TestBug object at 0x7f5c4d13f460>
env = <jinja2.environment.Environment object at 0x7f5c4c7999c0>

    def test_subproperty_if(self, env):
        t = env.from_string(
            "{% if object1.subproperty1 is eq object2.subproperty2 %}42{% endif %}"
        )
        assert (
>           t.render(
                object1={"subproperty1": "value"}, object2={"subproperty2": "value"}
            )
            == "42"
        )

tests/test_regression.py:544: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:956: in _render_tokens
    if _eval_expr(rest,ctx,self): out.append(body); pos=self._skip_end(tokens,p,'if')
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'object1.subproperty1 is eq object2.subproperty2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c7999c0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           object1.subproperty1 is eq object2.subproperty2
E                                      ^^^^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_________________________ TestBug.test_set_and_include _________________________

self = <test_regression.TestBug object at 0x7f5c4d13f790>

    def test_set_and_include(self):
        env = Environment(
            loader=DictLoader(
                {
                    "inc": "bar",
                    "main": '{% set foo = "foo" %}{{ foo }}{% include "inc" %}',
                }
            )
        )
>       assert env.get_template("main").render() == "foobar"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:559: AttributeError
__________________________ TestBug.test_loop_include ___________________________

self = <test_regression.TestBug object at 0x7f5c4d13fa60>

    def test_loop_include(self):
        env = Environment(
            loader=DictLoader(
                {
                    "inc": "{{ i }}",
                    "main": '{% for i in [1, 2, 3] %}{% include "inc" %}{% endfor %}',
                }
            )
        )
>       assert env.get_template("main").render() == "123"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:570: AttributeError
_________________________ TestBug.test_custom_context __________________________

self = <test_regression.TestBug object at 0x7f5c4d13f7c0>
env = <test_regression.TestBug.test_custom_context.<locals>.MyEnvironment object at 0x7f5c4cf58c10>

    def test_custom_context(self, env):
        from jinja2.runtime import Context
    
        class MyContext(Context):
            pass
    
        class MyEnvironment(Environment):
            context_class = MyContext
    
        loader = DictLoader({"base": "{{ foobar }}", "test": '{% extends "base" %}'})
        env = MyEnvironment(loader=loader)
>       assert env.get_template("test").render(foobar="test") == "test"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:592: AttributeError
_______________________ TestBug.test_recursive_loop_bug ________________________

self = <test_regression.TestBug object at 0x7f5c4d13f340>
env = <jinja2.environment.Environment object at 0x7f5c4cbd99c0>

    def test_recursive_loop_bug(self, env):
        tmpl = env.from_string(
            "{%- for value in values recursive %}1{% else %}0{% endfor -%}"
        )
>       assert tmpl.render(values=[]) == "0"

tests/test_regression.py:598: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:963: in _render_tokens
    names=[x.strip() for x in m.group(1).split(',')]; seq=list(_eval_expr(m.group(2),ctx,self));
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'values recursive'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cbd99c0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           values recursive
E                  ^^^^^^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_____________________ TestBug.test_scoped_block_loop_vars ______________________

self = <test_regression.TestBug object at 0x7f5c4d13e8c0>
env = <jinja2.environment.Environment object at 0x7f5c4cabd2a0>

        def test_scoped_block_loop_vars(self, env):
            tmpl = env.from_string(
                """\
    Start
    {% for i in ["foo", "bar"] -%}
    {% block body scoped -%}
    {{ loop.index }}) {{ i }}{% if loop.last %} last{% endif -%}
    {%- endblock %}
    {% endfor -%}
    End"""
            )
>           assert tmpl.render() == "Start\n1) foo\n2) bar last\nEnd"

tests/test_regression.py:618: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_____________________ TestBug.test_pass_context_loop_vars ______________________

self = <test_regression.TestBug object at 0x7f5c4d13c220>
env = <jinja2.environment.Environment object at 0x7f5c4d0e15a0>

        def test_pass_context_loop_vars(self, env):
            @pass_context
            def test(ctx):
                return f"{ctx['i']}{ctx['j']}"
    
            tmpl = env.from_string(
                """\
    {% set i = 42 %}
    {%- for idx in range(2) -%}
    {{ i }}{{ j }}
    {% set i = idx -%}
    {%- set j = loop.index -%}
    {{ test() }}
    {{ i }}{{ j }}
    {% endfor -%}
    {{ i }}{{ j }}"""
            )
            tmpl.globals["test"] = test
>           assert tmpl.render() == "42\n01\n01\n42\n12\n12\n42"

tests/test_regression.py:638: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:953: in _render_tokens
    k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
__________________ TestBug.test_pass_context_scoped_loop_vars __________________

self = <test_regression.TestBug object at 0x7f5c4d13d060>
env = <jinja2.environment.Environment object at 0x7f5c4c8cc460>

        def test_pass_context_scoped_loop_vars(self, env):
            @pass_context
            def test(ctx):
                return f"{ctx['i']}"
    
            tmpl = env.from_string(
                """\
    {% set i = 42 %}
    {%- for idx in range(2) -%}
    {{ i }}
    {%- set i = loop.index0 -%}
    {% block body scoped %}
    {{ test() }}
    {% endblock -%}
    {% endfor -%}
    {{ i }}"""
            )
            tmpl.globals["test"] = test
>           assert tmpl.render() == "42\n0\n42\n1\n42"

tests/test_regression.py:658: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:953: in _render_tokens
    k,e=rest.split('=',1); ctx[k.strip()]=_eval_expr(e,ctx,self); pos+=1
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_____________________ TestBug.test_pass_context_in_blocks ______________________

self = <test_regression.TestBug object at 0x7f5c4d13d930>
env = <jinja2.environment.Environment object at 0x7f5c4cf241c0>

        def test_pass_context_in_blocks(self, env):
            @pass_context
            def test(ctx):
                return f"{ctx['i']}"
    
            tmpl = env.from_string(
                """\
    {%- set i = 42 -%}
    {{ i }}
    {% block body -%}
    {% set i = 24 -%}
    {{ test() }}
    {% endblock -%}
    {{ i }}"""
            )
            tmpl.globals["test"] = test
>           assert tmpl.render() == "42\n24\n42"

tests/test_regression.py:676: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: TestBug.test_pass_context_in_blocks.<locals>.test() missing 1 required positional argument: 'ctx'

<string>:1: TypeError
___________________ TestBug.test_pass_context_block_and_loop ___________________

self = <test_regression.TestBug object at 0x7f5c4d13dd80>
env = <jinja2.environment.Environment object at 0x7f5c4ce4efb0>

        def test_pass_context_block_and_loop(self, env):
            @pass_context
            def test(ctx):
                return f"{ctx['i']}"
    
            tmpl = env.from_string(
                """\
    {%- set i = 42 -%}
    {% for idx in range(2) -%}
    {{ test() }}
    {%- set i = idx -%}
    {% block body scoped %}
    {{ test() }}
    {% set i = 24 -%}
    {{ test() }}
    {% endblock -%}
    {{ test() }}
    {% endfor -%}
    {{ test() }}"""
            )
            tmpl.globals["test"] = test
    
            # values set within a block or loop should not
            # show up outside of it
>           assert tmpl.render() == "42\n0\n24\n0\n42\n1\n24\n1\n42"

tests/test_regression.py:702: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: TestBug.test_pass_context_block_and_loop.<locals>.test() missing 1 required positional argument: 'ctx'

<string>:1: TypeError
_____________________ TestBug.test_cached_extends[extends] _____________________

self = <test_regression.TestBug object at 0x7f5c4d13fc10>, op = 'extends'

    @pytest.mark.parametrize("op", ["extends", "include"])
    def test_cached_extends(self, op):
        env = Environment(
            loader=DictLoader(
                {"base": "{{ x }} {{ y }}", "main": f"{{% {op} 'base' %}}"}
            )
        )
        env.globals["x"] = "x"
        env.globals["y"] = "y"
    
        # template globals overlay env globals
        tmpl = env.get_template("main", globals={"x": "bar"})
>       assert tmpl.render() == "bar y"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:716: AttributeError
_____________________ TestBug.test_cached_extends[include] _____________________

self = <test_regression.TestBug object at 0x7f5c4d13fd00>, op = 'include'

    @pytest.mark.parametrize("op", ["extends", "include"])
    def test_cached_extends(self, op):
        env = Environment(
            loader=DictLoader(
                {"base": "{{ x }} {{ y }}", "main": f"{{% {op} 'base' %}}"}
            )
        )
        env.globals["x"] = "x"
        env.globals["y"] = "y"
    
        # template globals overlay env globals
        tmpl = env.get_template("main", globals={"x": "bar"})
>       assert tmpl.render() == "bar y"
E       AttributeError: 'NoneType' object has no attribute 'render'

tests/test_regression.py:716: AttributeError
________________________________ test_loop_idx _________________________________

    def test_loop_idx():
        t = Template(TEST_IDX_TEMPLATE_STR_1)
        lst = [10]
        excepted_render = "[(len=1, revindex=1, index=1, val=10)]"
>       assert excepted_render == t.render(lst=lst)

tests/test_runtime.py:21: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
________________________________ test_loop_idx0 ________________________________

    def test_loop_idx0():
        t = Template(TEST_IDX0_TEMPLATE_STR_1)
        lst = [10]
        excepted_render = "[(len=1, revindex0=0, index0=0, val=10)]"
>       assert excepted_render == t.render(lst=lst)

tests/test_runtime.py:28: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
_______________________ test_iterator_not_advanced_early _______________________

    def test_iterator_not_advanced_early():
        t = Template("{% for _, g in gs %}{{ loop.index }} {{ g|list }}\n{% endfor %}")
>       out = t.render(
            gs=itertools.groupby([(1, "a"), (1, "b"), (2, "c"), (3, "d")], lambda x: x[0])
        )

tests/test_runtime.py:51: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:960: in _render_tokens
    m=re.match(r'(.+?)\s+in\s+(.+)',rest); body,p,end=self._render_tokens(tokens,pos+1,ctx,('else','endfor')); else_body=''; endpos=p+1
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
<string>:1: in <module>
    ???
src/jinja2/runtime.py:557: in __getattr__
    return self._fail_with_undefined_error()
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = Undefined, args = (), kwargs = {}

    @internalcode
    def _fail_with_undefined_error(self, *args: t.Any, **kwargs: t.Any) -> 'te.NoReturn':
        """Raise an :exc:`UndefinedError` when operations are performed
        on the undefined value.
        """
>       raise self._undefined_exception(self._undefined_message)
E       jinja2.exceptions.UndefinedError: 'loop' is undefined

src/jinja2/runtime.py:551: UndefinedError
___________________________ TestSandbox.test_unsafe ____________________________

self = <test_security.TestSandbox object at 0x7f5c4d15d600>
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4ce7cdf0>

    def test_unsafe(self, env):
        env = SandboxedEnvironment()
>       pytest.raises(
            SecurityError, env.from_string("{{ foo.foo() }}").render, foo=PrivateStuff()
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.SecurityError'>

tests/test_security.py:40: Failed
____________________ TestSandbox.test_immutable_environment ____________________

self = <test_security.TestSandbox object at 0x7f5c4d15d8d0>
env = <jinja2.sandbox.ImmutableSandboxedEnvironment object at 0x7f5c4c834250>

    def test_immutable_environment(self, env):
        env = ImmutableSandboxedEnvironment()
>       pytest.raises(SecurityError, env.from_string("{{ [].append(23) }}").render)
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.SecurityError'>

tests/test_security.py:60: Failed
_________________________ TestSandbox.test_restricted __________________________

self = <test_security.TestSandbox object at 0x7f5c4d15dba0>
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4c87d570>

    def test_restricted(self, env):
        env = SandboxedEnvironment()
>       pytest.raises(
            TemplateSyntaxError,
            env.from_string,
            "{% for item.attribute in seq %}...{% endfor %}",
        )
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateSyntaxError'>

tests/test_security.py:65: Failed
________________________ TestSandbox.test_template_data ________________________

self = <test_security.TestSandbox object at 0x7f5c4d15de70>
env = <jinja2.environment.Environment object at 0x7f5c4d0431c0>

    def test_template_data(self, env):
        env = Environment(autoescape=True)
        t = env.from_string(
            "{% macro say_hello(name) %}"
            "<p>Hello {{ name }}!</p>{% endmacro %}"
            '{{ say_hello("<blink>foo</blink>") }}'
        )
        escaped_out = "<p>Hello &lt;blink&gt;foo&lt;/blink&gt;!</p>"
>       assert t.render() == escaped_out

tests/test_security.py:84: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4d0431c0>
value = Undefined
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
_________________________ TestSandbox.test_attr_filter _________________________

self = <test_security.TestSandbox object at 0x7f5c4d13f250>
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4c75fa90>

    def test_attr_filter(self, env):
        env = SandboxedEnvironment()
        tmpl = env.from_string('{{ cls|attr("__subclasses__")() }}')
>       pytest.raises(SecurityError, tmpl.render, cls=int)

tests/test_security.py:97: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:911: in _eval_expr
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:911: in <listcomp>
    name,args,kwargs=_parse_call(f); value=env.call_filter(name,value,[_eval_expr(a,ctx,env) for a in args],{k:_eval_expr(v,ctx,env) for k,v in kwargs.items()},context=context)
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '"__subclasses__")('
ctx = {'cls': <class 'int'>, 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4c75fa90>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           "__subclasses__")(
E                           ^
E       SyntaxError: unmatched ')'

src/jinja2/environment.py:915: SyntaxError
________________ TestSandbox.test_binary_operator_intercepting _________________

self = <test_security.TestSandbox object at 0x7f5c4d13c940>
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4c7bf580>

    def test_binary_operator_intercepting(self, env):
        def disable_op(left, right):
            raise TemplateRuntimeError("that operator so does not work")
    
        for expr, ctx, rv in ("1 + 2", {}, "3"), ("a + 2", {"a": 2}, "4"):
            env = SandboxedEnvironment()
            env.binop_table["+"] = disable_op
            t = env.from_string(f"{{{{ {expr} }}}}")
            assert t.render(ctx) == rv
            env.intercepted_binops = frozenset(["+"])
            t = env.from_string(f"{{{{ {expr} }}}}")
>           with pytest.raises(TemplateRuntimeError):
E           Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateRuntimeError'>

tests/test_security.py:110: Failed
_________________ TestSandbox.test_unary_operator_intercepting _________________

self = <test_security.TestSandbox object at 0x7f5c4d13d600>
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4c707eb0>

    def test_unary_operator_intercepting(self, env):
        def disable_op(arg):
            raise TemplateRuntimeError("that operator so does not work")
    
        for expr, ctx, rv in ("-1", {}, "-1"), ("-a", {"a": 2}, "-2"):
            env = SandboxedEnvironment()
            env.unop_table["-"] = disable_op
            t = env.from_string(f"{{{{ {expr} }}}}")
>           assert t.render(ctx) == rv
E           AssertionError: assert '1' == '-1'
E             
E             - -1
E             + 1

tests/test_security.py:121: AssertionError
__________________ TestStringFormat.test_basic_format_safety ___________________

self = <test_security.TestStringFormat object at 0x7f5c4d15e140>

    def test_basic_format_safety(self):
        env = SandboxedEnvironment()
        t = env.from_string('{{ "a{0.__class__}b".format(42) }}')
>       assert t.render() == "ab"
E       assert "a<class 'int'>b" == 'ab'
E         
E         - ab
E         + a<class 'int'>b

tests/test_security.py:132: AssertionError
_________________ TestStringFormat.test_basic_format_all_okay __________________

self = <test_security.TestStringFormat object at 0x7f5c4d15ddb0>

    def test_basic_format_all_okay(self):
        env = SandboxedEnvironment()
        t = env.from_string('{{ "a{0.foo}b".format({"foo": 42}) }}')
>       assert t.render() == "a42b"

tests/test_security.py:137: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   AttributeError: 'dict' object has no attribute 'foo'

<string>:1: AttributeError
___________________ TestStringFormat.test_safe_format_safety ___________________

self = <test_security.TestStringFormat object at 0x7f5c4d15d720>

    def test_safe_format_safety(self):
        env = SandboxedEnvironment()
        t = env.from_string('{{ ("a{0.__class__}b{1}"|safe).format(42, "<foo>") }}')
>       assert t.render() == "ab&lt;foo&gt;"

tests/test_security.py:142: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
__________________ TestStringFormat.test_safe_format_all_okay __________________

self = <test_security.TestStringFormat object at 0x7f5c4d15d540>

    def test_safe_format_all_okay(self):
        env = SandboxedEnvironment()
        t = env.from_string('{{ ("a{0.foo}b{1}"|safe).format({"foo": 42}, "<foo>") }}')
>       assert t.render() == "a42b&lt;foo&gt;"

tests/test_security.py:147: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
__________________ TestStringFormat.test_empty_braces_format ___________________

self = <test_security.TestStringFormat object at 0x7f5c4d15e3e0>

    def test_empty_braces_format(self):
        env = SandboxedEnvironment()
        t1 = env.from_string('{{ ("a{}b{}").format("foo", "42")}}')
        t2 = env.from_string('{{ ("a{}b{}"|safe).format(42, "<foo>") }}')
        assert t1.render() == "afoob42"
>       assert t2.render() == "a42b&lt;foo&gt;"

tests/test_security.py:154: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
_________________ TestStringFormatMap.test_basic_format_safety _________________

self = <test_security.TestStringFormatMap object at 0x7f5c4d15e770>

    def test_basic_format_safety(self):
        env = SandboxedEnvironment()
        t = env.from_string('{{ "a{x.__class__}b".format_map({"x":42}) }}')
>       assert t.render() == "ab"
E       assert "a<class 'int'>b" == 'ab'
E         
E         - ab
E         + a<class 'int'>b

tests/test_security.py:161: AssertionError
________________ TestStringFormatMap.test_basic_format_all_okay ________________

self = <test_security.TestStringFormatMap object at 0x7f5c4d15ea40>

    def test_basic_format_all_okay(self):
        env = SandboxedEnvironment()
        t = env.from_string('{{ "a{x.foo}b".format_map({"x":{"foo": 42}}) }}')
>       assert t.render() == "a42b"

tests/test_security.py:166: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '"a{x.foo}b".format_map({"x":{"foo": 42'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.sandbox.SandboxedEnvironment object at 0x7f5c4c9450f0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           "a{x.foo}b".format_map({"x":{"foo": 42
E                                       ^
E       SyntaxError: '{' was never closed

src/jinja2/environment.py:915: SyntaxError
________________ TestStringFormatMap.test_safe_format_all_okay _________________

self = <test_security.TestStringFormatMap object at 0x7f5c4d15ed10>

    def test_safe_format_all_okay(self):
        env = SandboxedEnvironment()
        t = env.from_string(
            '{{ ("a{x.foo}b{y}"|safe).format_map({"x":{"foo": 42}, "y":"<foo>"}) }}'
        )
>       assert t.render() == "a42b&lt;foo&gt;"

tests/test_security.py:173: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
src/jinja2/environment.py:915: in _eval_base
    return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   ???
E   TypeError: unsupported operand type(s) for |: 'str' and 'Undefined'

<string>:1: TypeError
_________________ TestTestsCase.test_types[none is none-True] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4d15dde0>
env = <jinja2.environment.Environment object at 0x7f5c4c725300>
op = 'none is none', expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c725300>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'None', value = None, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'None'

src/jinja2/environment.py:1019: KeyError
________________ TestTestsCase.test_types[false is none-False] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4d15d9f0>
env = <jinja2.environment.Environment object at 0x7f5c4c941870>
op = 'false is none', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c941870>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'None', value = False, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'None'

src/jinja2/environment.py:1019: KeyError
_________________ TestTestsCase.test_types[true is none-False] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9cb80>
env = <jinja2.environment.Environment object at 0x7f5c4c735a50>
op = 'true is none', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c735a50>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'None', value = True, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'None'

src/jinja2/environment.py:1019: KeyError
__________________ TestTestsCase.test_types[42 is none-False] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9cc40>
env = <jinja2.environment.Environment object at 0x7f5c4c980250>
op = '42 is none', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c980250>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'None', value = 42, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'None'

src/jinja2/environment.py:1019: KeyError
_________________ TestTestsCase.test_types[none is true-False] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9cd00>
env = <jinja2.environment.Environment object at 0x7f5c4c87dc00>
op = 'none is true', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c87dc00>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'True', value = None, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'True'

src/jinja2/environment.py:1019: KeyError
________________ TestTestsCase.test_types[false is true-False] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9cdc0>
env = <jinja2.environment.Environment object at 0x7f5c4c8351b0>
op = 'false is true', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c8351b0>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'True', value = False, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'True'

src/jinja2/environment.py:1019: KeyError
_________________ TestTestsCase.test_types[true is true-True] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9ce80>
env = <jinja2.environment.Environment object at 0x7f5c4c7be020>
op = 'true is true', expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c7be020>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'True', value = True, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'True'

src/jinja2/environment.py:1019: KeyError
__________________ TestTestsCase.test_types[0 is true-False] ___________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9cf40>
env = <jinja2.environment.Environment object at 0x7f5c4ca3ffa0>
op = '0 is true', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ca3ffa0>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'True', value = 0, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'True'

src/jinja2/environment.py:1019: KeyError
__________________ TestTestsCase.test_types[1 is true-False] ___________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d000>
env = <jinja2.environment.Environment object at 0x7f5c4cbd8ac0>
op = '1 is true', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4cbd8ac0>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'True', value = 1, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'True'

src/jinja2/environment.py:1019: KeyError
__________________ TestTestsCase.test_types[42 is true-False] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d0c0>
env = <jinja2.environment.Environment object at 0x7f5c4c705210>
op = '42 is true', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c705210>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'True', value = 42, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'True'

src/jinja2/environment.py:1019: KeyError
________________ TestTestsCase.test_types[none is false-False] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d180>
env = <jinja2.environment.Environment object at 0x7f5c4c6d66e0>
op = 'none is false', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c6d66e0>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'False', value = None, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'False'

src/jinja2/environment.py:1019: KeyError
________________ TestTestsCase.test_types[false is false-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d240>
env = <jinja2.environment.Environment object at 0x7f5c4c906f80>
op = 'false is false', expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c906f80>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'False', value = False, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'False'

src/jinja2/environment.py:1019: KeyError
________________ TestTestsCase.test_types[true is false-False] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d300>
env = <jinja2.environment.Environment object at 0x7f5c4c980b20>
op = 'true is false', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c980b20>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'False', value = True, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'False'

src/jinja2/environment.py:1019: KeyError
__________________ TestTestsCase.test_types[0 is false-False] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d3c0>
env = <jinja2.environment.Environment object at 0x7f5c4ca68880>
op = '0 is false', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4ca68880>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'False', value = 0, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'False'

src/jinja2/environment.py:1019: KeyError
__________________ TestTestsCase.test_types[1 is false-False] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d480>
env = <jinja2.environment.Environment object at 0x7f5c4c75ccd0>
op = '1 is false', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c75ccd0>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'False', value = 1, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'False'

src/jinja2/environment.py:1019: KeyError
_________________ TestTestsCase.test_types[42 is false-False] __________________

self = <test_tests.TestTestsCase object at 0x7f5c4cf9d540>
env = <jinja2.environment.Environment object at 0x7f5c4c735b10>
op = '42 is false', expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("none is none", True),
            ("false is none", False),
            ("true is none", False),
            ("42 is none", False),
            ("none is true", False),
            ("false is true", False),
            ("true is true", True),
            ("0 is true", False),
            ("1 is true", False),
            ("42 is true", False),
            ("none is false", False),
            ("false is false", True),
            ("true is false", False),
            ("0 is false", False),
            ("1 is false", False),
            ("42 is false", False),
            ("none is boolean", False),
            ("false is boolean", True),
            ("true is boolean", True),
            ("0 is boolean", False),
            ("1 is boolean", False),
            ("42 is boolean", False),
            ("0.0 is boolean", False),
            ("1.0 is boolean", False),
            ("3.14159 is boolean", False),
            ("none is integer", False),
            ("false is integer", False),
            ("true is integer", False),
            ("42 is integer", True),
            ("3.14159 is integer", False),
            ("(10 ** 100) is integer", True),
            ("none is float", False),
            ("false is float", False),
            ("true is float", False),
            ("42 is float", False),
            ("4.2 is float", True),
            ("(10 ** 100) is float", False),
            ("none is number", False),
            ("false is number", True),
            ("true is number", True),
            ("42 is number", True),
            ("3.14159 is number", True),
            ("complex is number", True),
            ("(10 ** 100) is number", True),
            ("none is string", False),
            ("false is string", False),
            ("true is string", False),
            ("42 is string", False),
            ('"foo" is string', True),
            ("none is sequence", False),
            ("false is sequence", False),
            ("42 is sequence", False),
            ('"foo" is sequence', True),
            ("[] is sequence", True),
            ("[1, 2, 3] is sequence", True),
            ("{} is sequence", True),
            ("none is mapping", False),
            ("false is mapping", False),
            ("42 is mapping", False),
            ('"foo" is mapping', False),
            ("[] is mapping", False),
            ("{} is mapping", True),
            ("mydict is mapping", True),
            ("none is iterable", False),
            ("false is iterable", False),
            ("42 is iterable", False),
            ('"foo" is iterable', True),
            ("[] is iterable", True),
            ("{} is iterable", True),
            ("range(5) is iterable", True),
            ("none is callable", False),
            ("false is callable", False),
            ("42 is callable", False),
            ('"foo" is callable', False),
            ("[] is callable", False),
            ("{} is callable", False),
            ("range is callable", True),
        ),
    )
    def test_types(self, env, op, expect):
        t = env.from_string(f"{{{{ {op} }}}}")
>       assert t.render(mydict=MyDict(), complex=complex(1, 2)) == str(expect)

tests/test_tests.py:115: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c735b10>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'False', value = 42, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...<class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>, 'mydict': {}, 'complex': (1+2j)} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'False'

src/jinja2/environment.py:1019: KeyError
__________________________ TestTestsCase.test_equalto __________________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd08e0>
env = <jinja2.environment.Environment object at 0x7f5c4c836b90>

    def test_equalto(self, env):
        tmpl = env.from_string(
            "{{ foo is eq 12 }}|"
            "{{ foo is eq 0 }}|"
            "{{ foo is eq (3 * 4) }}|"
            '{{ bar is eq "baz" }}|'
            '{{ bar is eq "zab" }}|'
            '{{ bar is eq ("ba" + "z") }}|'
            "{{ bar is eq bar }}|"
            "{{ bar is eq foo }}"
        )
        assert (
>           tmpl.render(foo=12, bar="baz")
            == "True|False|True|True|False|True|True|False"
        )

tests/test_tests.py:133: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'foo is eq 12'
ctx = {'bar': 'baz', 'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': 12, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c836b90>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           foo is eq 12
E                     ^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[eq 2-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4d15c9d0>
env = <jinja2.environment.Environment object at 0x7f5c4c941450>, op = 'eq 2'
expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is eq 2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c941450>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is eq 2
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[eq 3-False] ________________

self = <test_tests.TestTestsCase object at 0x7f5c4d13f880>
env = <jinja2.environment.Environment object at 0x7f5c4c727be0>, op = 'eq 3'
expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is eq 3'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c727be0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is eq 3
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[ne 3-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0460>
env = <jinja2.environment.Environment object at 0x7f5c4c905c00>, op = 'ne 3'
expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is ne 3'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c905c00>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is ne 3
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[ne 2-False] ________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0520>
env = <jinja2.environment.Environment object at 0x7f5c4c79bbe0>, op = 'ne 2'
expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is ne 2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c79bbe0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is ne 2
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[lt 3-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0a00>
env = <jinja2.environment.Environment object at 0x7f5c4ce386d0>, op = 'lt 3'
expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is lt 3'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4ce386d0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is lt 3
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[lt 2-False] ________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0ac0>
env = <jinja2.environment.Environment object at 0x7f5c4c798be0>, op = 'lt 2'
expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is lt 2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c798be0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is lt 2
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[le 2-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0b80>
env = <jinja2.environment.Environment object at 0x7f5c4c7bfc40>, op = 'le 2'
expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is le 2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c7bfc40>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is le 2
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[le 1-False] ________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0c40>
env = <jinja2.environment.Environment object at 0x7f5c4c982710>, op = 'le 1'
expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is le 1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c982710>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is le 1
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[gt 1-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0d00>
env = <jinja2.environment.Environment object at 0x7f5c4ca3ead0>, op = 'gt 1'
expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is gt 1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4ca3ead0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is gt 1
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[gt 2-False] ________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0dc0>
env = <jinja2.environment.Environment object at 0x7f5c4cac6d10>, op = 'gt 2'
expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is gt 2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cac6d10>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is gt 2
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[ge 2-True] _________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0e80>
env = <jinja2.environment.Environment object at 0x7f5c4c904580>, op = 'ge 2'
expect = True

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is ge 2'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c904580>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is ge 2
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
________________ TestTestsCase.test_compare_aliases[ge 3-False] ________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd0f40>
env = <jinja2.environment.Environment object at 0x7f5c4c9474c0>, op = 'ge 3'
expect = False

    @pytest.mark.parametrize(
        "op,expect",
        (
            ("eq 2", True),
            ("eq 3", False),
            ("ne 3", True),
            ("ne 2", False),
            ("lt 3", True),
            ("lt 2", False),
            ("le 2", True),
            ("le 1", False),
            ("gt 1", True),
            ("gt 2", False),
            ("ge 2", True),
            ("ge 3", False),
        ),
    )
    def test_compare_aliases(self, env, op, expect):
        t = env.from_string(f"{{{{ 2 is {op} }}}}")
>       assert t.render() == str(expect)

tests/test_tests.py:156: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '2 is ge 3'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c9474c0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           2 is ge 3
E                   ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
__________________________ TestTestsCase.test_sameas ___________________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd11e0>
env = <jinja2.environment.Environment object at 0x7f5c4ca3ef80>

    def test_sameas(self, env):
        tmpl = env.from_string("{{ foo is sameas false }}|{{ 0 is sameas false }}")
>       assert tmpl.render(foo=False) == "True|False"

tests/test_tests.py:160: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'foo is sameas False'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': False, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4ca3ef80>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           foo is sameas False
E                         ^^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_____________________ TestTestsCase.test_no_paren_for_arg1 _____________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd14e0>
env = <jinja2.environment.Environment object at 0x7f5c4cf9d420>

    def test_no_paren_for_arg1(self, env):
        tmpl = env.from_string("{{ foo is sameas none }}")
>       assert tmpl.render(foo=None) == "True"

tests/test_tests.py:164: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = 'foo is sameas None'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'foo': None, 'joiner': <class 'jinja2.utils.Joiner'>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4cf9d420>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           foo is sameas None
E                         ^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
__________________________ TestTestsCase.test_escaped __________________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd1810>
env = <jinja2.environment.Environment object at 0x7f5c4c79b8b0>

    def test_escaped(self, env):
        env = Environment(autoescape=True)
        tmpl = env.from_string("{{ x is escaped }}|{{ y is escaped }}")
>       assert tmpl.render(x="foo", y=Markup("foo")) == "False|True"

tests/test_tests.py:169: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c79b8b0>, value = False
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}

    def _finalize_value(self,value,ctx):
        if self.finalize:
            f=self.finalize; pa=getattr(f,'jinja_pass_arg',None)
            if pa is _PassArg.context: value=f(Context(self,ctx,None,{}),value)
            elif pa is _PassArg.eval_context: value=f(EvalContext(self),value)
            elif pa is _PassArg.environment: value=f(self,value)
            else: value=f(value)
        if value is None: value=''
        ae=self.autoescape(None) if callable(self.autoescape) else self.autoescape
>       return str(escape(value) if ae and not hasattr(value,'__html__') else value)
E       NameError: name 'escape' is not defined

src/jinja2/environment.py:992: NameError
________________________ TestTestsCase.test_greaterthan ________________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd1b40>
env = <jinja2.environment.Environment object at 0x7f5c4c704640>

    def test_greaterthan(self, env):
        tmpl = env.from_string("{{ 1 is greaterthan 0 }}|{{ 0 is greaterthan 1 }}")
>       assert tmpl.render() == "True|False"

tests/test_tests.py:173: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '1 is greaterthan 0'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c704640>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           1 is greaterthan 0
E                            ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_________________________ TestTestsCase.test_lessthan __________________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd1e70>
env = <jinja2.environment.Environment object at 0x7f5c4c75ce80>

    def test_lessthan(self, env):
        tmpl = env.from_string("{{ 0 is lessthan 1 }}|{{ 1 is lessthan 0 }}")
>       assert tmpl.render() == "True|False"

tests/test_tests.py:177: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '0 is lessthan 1'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c75ce80>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           0 is lessthan 1
E                         ^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
______________________ TestTestsCase.test_multiple_tests _______________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd21a0>

    def test_multiple_tests(self):
        items = []
    
        def matching(x, y):
            items.append((x, y))
            return False
    
        env = Environment()
        env.tests["matching"] = matching
        tmpl = env.from_string(
            "{{ 'us-west-1' is matching '(us-east-1|ap-northeast-1)'"
            " or 'stage' is matching '(dev|stage)' }}"
        )
>       assert tmpl.render() == "False"

tests/test_tests.py:192: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = "'us-west-1' is matching '(us-east-1|ap-northeast-1)' or 'stage' is matching '(dev|stage)'"
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c6d51b0>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           'us-west-1' is matching '(us-east-1|ap-northeast-1)' or 'stage' is matching '(dev|stage)'
E                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
____________________________ TestTestsCase.test_in _____________________________

self = <test_tests.TestTestsCase object at 0x7f5c4cfd2470>
env = <jinja2.environment.Environment object at 0x7f5c4c980790>

    def test_in(self, env):
        tmpl = env.from_string(
            '{{ "o" is in "foo" }}|'
            '{{ "foo" is in "foo" }}|'
            '{{ "b" is in "foo" }}|'
            "{{ 1 is in ((1, 2)) }}|"
            "{{ 3 is in ((1, 2)) }}|"
            "{{ 1 is in [1, 2] }}|"
            "{{ 3 is in [1, 2] }}|"
            '{{ "foo" is in {"foo": 1}}}|'
            '{{ "baz" is in {"bar": 1}}}'
        )
>       assert tmpl.render() == "True|True|False|True|False|True|False|True|False"

tests/test_tests.py:210: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:909: in _eval_expr
    parts=_split_top(expr,'|'); value=_eval_base(parts[0],ctx,env); context=Context(env,ctx,None,{})
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

expr = '"o" is in "foo"'
ctx = {'cycler': <class 'jinja2.utils.Cycler'>, 'dict': <class 'dict'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0>, ...}
env = <jinja2.environment.Environment object at 0x7f5c4c980790>

    def _eval_base(expr,ctx,env):
        loc=_EvalLocals(env,{k:_wrap(v,env) for k,v in {**env.globals,**ctx}.items()})
>       return eval(expr, {'range':range,'len':len,'list':list,'dict':dict,'str':str,'int':int,'True':True,'False':False,'None':None}, loc)
E         File "<string>", line 1
E           "o" is in "foo"
E                  ^^
E       SyntaxError: invalid syntax

src/jinja2/environment.py:915: SyntaxError
_____________________________ test_name_undefined ______________________________

env = <jinja2.environment.Environment object at 0x7f5c4c7350c0>

    def test_name_undefined(env):
>       with pytest.raises(TemplateAssertionError, match="No test named 'f'"):
E       Failed: DID NOT RAISE <class 'jinja2.exceptions.TemplateAssertionError'>

tests/test_tests.py:214: Failed
__________________________ test_name_undefined_in_if ___________________________

env = <jinja2.environment.Environment object at 0x7f5c4c799030>

    def test_name_undefined_in_if(env):
        t = env.from_string("{% if x is defined %}{{ x is f }}{% endif %}")
>       assert t.render() == ""

tests/test_tests.py:220: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/jinja2/environment.py:999: in _tmpl_render
    def _tmpl_render(self,*args,**kwargs): return self.environment._render_source(self.source,{**self.globals,**dict(*args,**kwargs)},self.name)
src/jinja2/environment.py:994: in _render_source
    out=self._render_tokens(self._tmpl_tokens(source),0,dict(vars or {}))[0]
src/jinja2/environment.py:955: in _render_tokens
    body,p,end=self._render_tokens(tokens,pos+1,ctx,('elif','else','endif'))
src/jinja2/environment.py:949: in _render_tokens
    if typ=='var': out.append(self._finalize_value(_eval_expr(val,ctx,self),ctx)); pos+=1; continue
src/jinja2/environment.py:908: in _eval_expr
    rv=env.call_test(m.group(3),val,args,{},context=Context(env,ctx,None,{})); return not rv if m.group(2) else rv
src/jinja2/environment.py:1026: in <lambda>
    Environment.call_test = lambda self,name,value,args=None,kwargs=None,context=None,eval_ctx=None: _env_filter_test_fixed(self,self.tests,name,value,args,kwargs,context,eval_ctx)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <jinja2.environment.Environment object at 0x7f5c4c799030>
mapping = {'!=': <built-in function ne>, '<': <built-in function lt>, '<=': <built-in function le>, '==': <built-in function eq>, ...}
name = 'f', value = Undefined, args = [], kwargs = {}
context = <Context {'range': <class 'range'>, 'dict': <class 'dict'>, 'lipsum': <function generate_lorem_ipsum at 0x7f5c4d845ab0...jinja2.utils.Cycler'>, 'joiner': <class 'jinja2.utils.Joiner'>, 'namespace': <class 'jinja2.utils.Namespace'>} of None>
eval_ctx = None

    def _env_filter_test_fixed(self, mapping, name, value, args=None, kwargs=None, context=None, eval_ctx=None):
>       func = mapping[name]; rest=list(args or ()); kwargs=dict(kwargs or {}); pa=getattr(func,'jinja_pass_arg',None)
E       KeyError: 'f'

src/jinja2/environment.py:1019: KeyError
___________________________ TestLRUCache.test_simple ___________________________

self = <test_utils.TestLRUCache object at 0x7f5c4cfd2b30>

    def test_simple(self):
        d = LRUCache(3)
        d["a"] = 1
        d["b"] = 2
        d["c"] = 3
        d["a"]
        d["d"] = 4
>       assert d.keys() == ["d", "a", "c"]
E       AssertionError: assert ['c', 'a', 'd'] == ['d', 'a', 'c']
E         
E         At index 0 diff: 'c' != 'd'
E         Use -v to get more diff

tests/test_utils.py:26: AssertionError
___________________________ TestLRUCache.test_values ___________________________

self = <test_utils.TestLRUCache object at 0x7f5c4cfd2e00>

    def test_values(self):
        cache = LRUCache(3)
        cache["b"] = 1
        cache["a"] = 2
>       assert cache.values() == [2, 1]
E       assert [1, 2] == [2, 1]
E         
E         At index 0 diff: 1 != 2
E         Use -v to get more diff

tests/test_utils.py:32: AssertionError
________________________ TestLRUCache.test_copy[copy0] _________________________

self = <test_utils.TestLRUCache object at 0x7f5c4cfd36d0>
copy_func = <function LRUCache.copy at 0x7f5c4d845f30>

    @pytest.mark.parametrize("copy_func", [LRUCache.copy, shallow_copy])
    def test_copy(self, copy_func):
        cache = LRUCache(2)
        cache["a"] = 1
        cache["b"] = 2
        copy = copy_func(cache)
        assert copy._queue == cache._queue
        copy["c"] = 3
        assert copy._queue != cache._queue
>       assert copy.keys() == ["c", "b"]
E       AssertionError: assert ['b', 'c'] == ['c', 'b']
E         
E         At index 0 diff: 'b' != 'c'
E         Use -v to get more diff

tests/test_utils.py:59: AssertionError
________________________ TestLRUCache.test_copy[copy1] _________________________

self = <test_utils.TestLRUCache object at 0x7f5c4cfd3790>
copy_func = <function copy at 0x7f5c4ea8caf0>

    @pytest.mark.parametrize("copy_func", [LRUCache.copy, shallow_copy])
    def test_copy(self, copy_func):
        cache = LRUCache(2)
        cache["a"] = 1
        cache["b"] = 2
        copy = copy_func(cache)
        assert copy._queue == cache._queue
        copy["c"] = 3
>       assert copy._queue != cache._queue
E       AssertionError: assert deque(['b', 'c']) != deque(['b', 'c'])
E        +  where deque(['b', 'c']) = <LRUCache {'b': 2, 'c': 3}>._queue
E        +  and   deque(['b', 'c']) = <LRUCache {'b': 2, 'c': 3}>._queue

tests/test_utils.py:58: AssertionError
___________________________ TestLRUCache.test_items ____________________________

self = <test_utils.TestLRUCache object at 0x7f5c4cfd3be0>

    def test_items(self):
        """Test various items, keys, values and iterators of LRUCache."""
        d = LRUCache(3)
        d["a"] = 1
        d["b"] = 2
        d["c"] = 3
>       assert d.items() == [("c", 3), ("b", 2), ("a", 1)]
E       AssertionError: assert [('a', 1), ('b', 2), ('c', 3)] == [('c', 3), ('b', 2), ('a', 1)]
E         
E         At index 0 diff: ('a', 1) != ('c', 3)
E         Use -v to get more diff

tests/test_utils.py:83: AssertionError
______________________ TestHelpers.test_object_type_repr _______________________

self = <test_utils.TestHelpers object at 0x7f5c4cfd2f80>

    def test_object_type_repr(self):
        class X:
            pass
    
>       assert object_type_repr(42) == "int object"
E       AssertionError: assert 'int' == 'int object'
E         
E         - int object
E         + int

tests/test_utils.py:111: AssertionError
____________________ TestLoremIpsum.test_lorem_ipsum_markup ____________________

self = <test_utils.TestLoremIpsum object at 0x7f5c4cfd3f70>

    def test_lorem_ipsum_markup(self):
        """Test that output of lorem_ipsum is Markup by default."""
>       assert isinstance(generate_lorem_ipsum(), Markup)
E       AssertionError: assert False
E        +  where False = isinstance('<p>Sed do consectetur eiusmod do et ipsum lorem sed sed lorem eiusmod lorem amet amet consectetur eiusmod dolor aliqu...et ut do dolore sed dolor et do amet et elit sit amet aliqua incididunt sit ipsum sit tempor sit sed dolor labore.</p>', Markup)
E        +    where '<p>Sed do consectetur eiusmod do et ipsum lorem sed sed lorem eiusmod lorem amet amet consectetur eiusmod dolor aliqu...et ut do dolore sed dolor et do amet et elit sit amet aliqua incididunt sit ipsum sit tempor sit sed dolor labore.</p>' = generate_lorem_ipsum()

tests/test_utils.py:148: AssertionError
_____________________ TestLoremIpsum.test_lorem_ipsum_max ______________________

self = <test_utils.TestLoremIpsum object at 0x7f5c4cff8af0>

    def test_lorem_ipsum_max(self):
        """Test that at least max words are in the output of each line"""
        for _ in range(5):
            m = random.randrange(21, 100)
            for _ in range(10):
>               assert generate_lorem_ipsum(n=1, max=m, html=False).count(" ") < m - 1
E               AssertionError: assert 62 < (63 - 1)
E                +  where 62 = <built-in method count of str object at 0x7f5c4cca6bf0>(' ')
E                +    where <built-in method count of str object at 0x7f5c4cca6bf0> = 'Lorem ipsum adipiscing elit ut et adipiscing incididunt tempor ipsum ut dolor magna dolor aliqua et dolore tempor tem...do magna tempor dolore amet labore dolore dolore magna ipsum sit sed dolore et dolor ut labore consectetur ut eiusmod.'.count
E                +      where 'Lorem ipsum adipiscing elit ut et adipiscing incididunt tempor ipsum ut dolor magna dolor aliqua et dolore tempor tem...do magna tempor dolore amet labore dolore dolore magna ipsum sit sed dolore et dolor ut labore consectetur ut eiusmod.' = generate_lorem_ipsum(n=1, max=63, html=False)

tests/test_utils.py:172: AssertionError
--------------------------------- JSON report ----------------------------------
report saved to: report.json
=========================== short test summary info ============================
FAILED tests/test_api.py::TestExtendedAPI::test_item_and_attribute -   File "...
FAILED tests/test_api.py::TestExtendedAPI::test_eval_finalize - NameError: na...
FAILED tests/test_api.py::TestExtendedAPI::test_template_passthrough - assert...
FAILED tests/test_api.py::TestExtendedAPI::test_get_template_undefined - Fail...
FAILED tests/test_api.py::TestExtendedAPI::test_autoescape_autoselect - Attri...
FAILED tests/test_api.py::TestMeta::test_find_undeclared_variables - Attribut...
FAILED tests/test_api.py::TestMeta::test_find_refererenced_templates - Attrib...
FAILED tests/test_api.py::TestMeta::test_find_included_templates - AttributeE...
FAILED tests/test_api.py::TestStreaming::test_basic_streaming - TypeError: 'N...
FAILED tests/test_api.py::TestStreaming::test_buffered_streaming - AttributeE...
FAILED tests/test_api.py::TestStreaming::test_streaming_behavior - AttributeE...
FAILED tests/test_api.py::TestStreaming::test_dump_stream - AttributeError: '...
FAILED tests/test_api.py::TestUndefined::test_stopiteration_is_undefined - St...
FAILED tests/test_api.py::TestUndefined::test_logging_undefined - AttributeEr...
FAILED tests/test_api.py::TestUndefined::test_default_undefined - AttributeEr...
FAILED tests/test_api.py::TestUndefined::test_chainable_undefined - Attribute...
FAILED tests/test_api.py::TestUndefined::test_debug_undefined - AttributeErro...
FAILED tests/test_api.py::TestUndefined::test_strict_undefined - AttributeErr...
FAILED tests/test_api.py::TestUndefined::test_indexing_gives_undefined - Type...
FAILED tests/test_api.py::TestUndefined::test_object_repr - AssertionError: R...
FAILED tests/test_api.py::TestLowLevel::test_custom_code_generator - Assertio...
FAILED tests/test_api.py::TestLowLevel::test_custom_context - AssertionError:...
FAILED tests/test_async.py::test_basic_async - AssertionError: assert None ==...
FAILED tests/test_async.py::test_await_on_calls - AssertionError: assert None...
FAILED tests/test_async.py::test_await_on_calls_normal_render - TypeError: un...
FAILED tests/test_async.py::test_await_and_macros - AssertionError: assert No...
FAILED tests/test_async.py::test_async_blocks - AssertionError: assert None =...
FAILED tests/test_async.py::test_async_generate - TypeError: 'NoneType' objec...
FAILED tests/test_async.py::test_async_iteration_in_templates - TypeError: 'N...
FAILED tests/test_async.py::test_async_iteration_in_templates_extended - Type...
FAILED tests/test_async.py::TestAsyncImports::test_context_imports - jinja2.e...
FAILED tests/test_async.py::TestAsyncImports::test_exports - AttributeError: ...
FAILED tests/test_async.py::TestAsyncImports::test_import_with_globals - jinj...
FAILED tests/test_async.py::TestAsyncImports::test_import_with_globals_override
FAILED tests/test_async.py::TestAsyncImports::test_from_import_with_globals
FAILED tests/test_async.py::TestAsyncIncludes::test_context_include - Attribu...
FAILED tests/test_async.py::TestAsyncIncludes::test_choice_includes - Attribu...
FAILED tests/test_async.py::TestAsyncIncludes::test_include_ignoring_missing
FAILED tests/test_async.py::TestAsyncIncludes::test_context_include_with_overrides
FAILED tests/test_async.py::TestAsyncIncludes::test_unoptimized_scopes - Attr...
FAILED tests/test_async.py::TestAsyncIncludes::test_unoptimized_scopes_autoescape
FAILED tests/test_async.py::TestAsyncForLoop::test_context_vars[<lambda>0] - ...
FAILED tests/test_async.py::TestAsyncForLoop::test_context_vars[iter] - jinja...
FAILED tests/test_async.py::TestAsyncForLoop::test_context_vars[reversed] - j...
FAILED tests/test_async.py::TestAsyncForLoop::test_context_vars[<lambda>1] - ...
FAILED tests/test_async.py::TestAsyncForLoop::test_context_vars[auto_aiter]
FAILED tests/test_async.py::TestAsyncForLoop::test_cycling - jinja2.exception...
FAILED tests/test_async.py::TestAsyncForLoop::test_lookaround - jinja2.except...
FAILED tests/test_async.py::TestAsyncForLoop::test_changed - jinja2.exception...
FAILED tests/test_async.py::TestAsyncForLoop::test_recursive - jinja2.excepti...
FAILED tests/test_async.py::TestAsyncForLoop::test_recursive_lookaround - jin...
FAILED tests/test_async.py::TestAsyncForLoop::test_recursive_depth0 - jinja2....
FAILED tests/test_async.py::TestAsyncForLoop::test_recursive_depth - jinja2.e...
FAILED tests/test_async.py::TestAsyncForLoop::test_looploop - jinja2.exceptio...
FAILED tests/test_async.py::TestAsyncForLoop::test_reversed_bug - jinja2.exce...
FAILED tests/test_async.py::TestAsyncForLoop::test_loop_errors -   File "<str...
FAILED tests/test_async.py::TestAsyncForLoop::test_loop_filter -   File "<str...
FAILED tests/test_async.py::TestAsyncForLoop::test_scoped_special_var - jinja...
FAILED tests/test_async.py::TestAsyncForLoop::test_scoped_loop_var - jinja2.e...
FAILED tests/test_async.py::TestAsyncForLoop::test_recursive_empty_loop_iter
FAILED tests/test_async.py::TestAsyncForLoop::test_call_in_loop - jinja2.exce...
FAILED tests/test_async.py::TestAsyncForLoop::test_scoping_bug - AssertionErr...
FAILED tests/test_async.py::TestAsyncForLoop::test_recursive_loop_filter - ji...
FAILED tests/test_async.py::TestAsyncForLoop::test_nonrecursive_loop_filter
FAILED tests/test_async.py::TestAsyncForLoop::test_bare_async - AssertionErro...
FAILED tests/test_async.py::test_namespace_awaitable - AssertionError: assert...
FAILED tests/test_async.py::test_chainable_undefined_aiter - AssertionError: ...
FAILED tests/test_async.py::test_native_async - assert None == 23
FAILED tests/test_async.py::test_native_list_async - assert None == [0, 1, 2]
FAILED tests/test_async.py::test_getitem_after_filter - jinja2.exceptions.Und...
FAILED tests/test_async_filters.py::test_first[<lambda>1] - TypeError: 'async...
FAILED tests/test_async_filters.py::test_groupby[<lambda>0] - jinja2.exceptio...
FAILED tests/test_async_filters.py::test_groupby[<lambda>1] - jinja2.exceptio...
FAILED tests/test_async_filters.py::test_groupby_case[False-a: 1, 3\nb: 2\n]
FAILED tests/test_async_filters.py::test_groupby_case[True-A: 3\na: 1\nb: 2\n]
FAILED tests/test_async_filters.py::test_groupby_tuple_index[<lambda>0] -   F...
FAILED tests/test_async_filters.py::test_groupby_tuple_index[<lambda>1] -   F...
FAILED tests/test_async_filters.py::test_groupby_multidot[<lambda>0] - jinja2...
FAILED tests/test_async_filters.py::test_groupby_multidot[<lambda>1] - jinja2...
FAILED tests/test_async_filters.py::test_join_env_int[<lambda>1] - TypeError:...
FAILED tests/test_async_filters.py::test_join_string_list[<lambda>0] - TypeEr...
FAILED tests/test_async_filters.py::test_join_string_list[<lambda>1] - TypeEr...
FAILED tests/test_async_filters.py::test_join_attribute[<lambda>1] - TypeErro...
FAILED tests/test_async_filters.py::test_simple_reject[<lambda>1] - TypeError...
FAILED tests/test_async_filters.py::test_bool_reject[<lambda>1] - TypeError: ...
FAILED tests/test_async_filters.py::test_simple_select[<lambda>1] - TypeError...
FAILED tests/test_async_filters.py::test_bool_select[<lambda>1] - TypeError: ...
FAILED tests/test_async_filters.py::test_simple_select_attr[<lambda>1] - Type...
FAILED tests/test_async_filters.py::test_simple_map[<lambda>1] - TypeError: '...
FAILED tests/test_async_filters.py::test_attribute_map[<lambda>1] - TypeError...
FAILED tests/test_async_filters.py::test_empty_map - TypeError: 'NoneType' ob...
FAILED tests/test_async_filters.py::test_sum[<lambda>1] - TypeError: 'async_g...
FAILED tests/test_async_filters.py::test_sum_attributes[<lambda>1] - TypeErro...
FAILED tests/test_async_filters.py::test_slice[<lambda>1] - TypeError: 'async...
FAILED tests/test_async_filters.py::test_custom_async_filter - AssertionError...
FAILED tests/test_async_filters.py::test_custom_async_iteratable_filter[<lambda>0]
FAILED tests/test_async_filters.py::test_custom_async_iteratable_filter[<lambda>1]
FAILED tests/test_bytecode_cache.py::TestByteCodeCache::test_simple - Attribu...
FAILED tests/test_compile.py::test_filters_deterministic - IndexError: list i...
FAILED tests/test_compile.py::test_import_as_with_context_deterministic - Ind...
FAILED tests/test_core_tags.py::TestForLoop::test_context_vars - jinja2.excep...
FAILED tests/test_core_tags.py::TestForLoop::test_cycling - jinja2.exceptions...
FAILED tests/test_core_tags.py::TestForLoop::test_lookaround - jinja2.excepti...
FAILED tests/test_core_tags.py::TestForLoop::test_changed - jinja2.exceptions...
FAILED tests/test_core_tags.py::TestForLoop::test_recursive - jinja2.exceptio...
FAILED tests/test_core_tags.py::TestForLoop::test_recursive_lookaround - jinj...
FAILED tests/test_core_tags.py::TestForLoop::test_recursive_depth0 - jinja2.e...
FAILED tests/test_core_tags.py::TestForLoop::test_recursive_depth - jinja2.ex...
FAILED tests/test_core_tags.py::TestForLoop::test_looploop - jinja2.exception...
FAILED tests/test_core_tags.py::TestForLoop::test_reversed_bug - jinja2.excep...
FAILED tests/test_core_tags.py::TestForLoop::test_loop_errors -   File "<stri...
FAILED tests/test_core_tags.py::TestForLoop::test_loop_filter -   File "<stri...
FAILED tests/test_core_tags.py::TestForLoop::test_loop_unassignable - Failed:...
FAILED tests/test_core_tags.py::TestForLoop::test_scoped_special_var - jinja2...
FAILED tests/test_core_tags.py::TestForLoop::test_scoped_loop_var - jinja2.ex...
FAILED tests/test_core_tags.py::TestForLoop::test_recursive_empty_loop_iter
FAILED tests/test_core_tags.py::TestForLoop::test_call_in_loop - jinja2.excep...
FAILED tests/test_core_tags.py::TestForLoop::test_scoping_bug - AssertionErro...
FAILED tests/test_core_tags.py::TestForLoop::test_intended_scoping_with_set
FAILED tests/test_core_tags.py::TestIfCondition::test_elif - AssertionError: ...
FAILED tests/test_core_tags.py::TestIfCondition::test_elif_deep - AssertionEr...
FAILED tests/test_core_tags.py::TestIfCondition::test_complete - AssertionErr...
FAILED tests/test_core_tags.py::TestMacros::test_simple - AssertionError: ass...
FAILED tests/test_core_tags.py::TestMacros::test_scoping - AssertionError: as...
FAILED tests/test_core_tags.py::TestMacros::test_arguments - AssertionError: ...
FAILED tests/test_core_tags.py::TestMacros::test_arguments_defaults_nonsense
FAILED tests/test_core_tags.py::TestMacros::test_caller_defaults_nonsense - F...
FAILED tests/test_core_tags.py::TestMacros::test_varargs - AssertionError: as...
FAILED tests/test_core_tags.py::TestMacros::test_simple_call - jinja2.excepti...
FAILED tests/test_core_tags.py::TestMacros::test_complex_call - jinja2.except...
FAILED tests/test_core_tags.py::TestMacros::test_caller_undefined - Assertion...
FAILED tests/test_core_tags.py::TestMacros::test_include - jinja2.exceptions....
FAILED tests/test_core_tags.py::TestMacros::test_macro_api - AttributeError: ...
FAILED tests/test_core_tags.py::TestMacros::test_callself - jinja2.exceptions...
FAILED tests/test_core_tags.py::TestMacros::test_macro_defaults_self_ref - At...
FAILED tests/test_core_tags.py::TestSet::test_normal - AttributeError: 'NoneT...
FAILED tests/test_core_tags.py::TestSet::test_block - AttributeError: 'NoneTy...
FAILED tests/test_core_tags.py::TestSet::test_block_escaping - NameError: nam...
FAILED tests/test_core_tags.py::TestSet::test_set_invalid - Failed: DID NOT R...
FAILED tests/test_core_tags.py::TestSet::test_namespace_redefined - Failed: D...
FAILED tests/test_core_tags.py::TestSet::test_namespace - AttributeError: bar
FAILED tests/test_core_tags.py::TestSet::test_init_namespace - AttributeError: b
FAILED tests/test_core_tags.py::TestSet::test_namespace_loop - AssertionError...
FAILED tests/test_core_tags.py::TestSet::test_namespace_macro - AssertionErro...
FAILED tests/test_core_tags.py::TestSet::test_block_escaping_filtered - NameE...
FAILED tests/test_core_tags.py::TestSet::test_block_filtered - AssertionError...
FAILED tests/test_core_tags.py::TestSet::test_block_filtered_set - AssertionE...
FAILED tests/test_core_tags.py::TestWith::test_with - AssertionError: assert ...
FAILED tests/test_core_tags.py::TestWith::test_with_argument_scoping - Assert...
FAILED tests/test_debug.py::TestDebug::test_runtime_error - AssertionError: T...
FAILED tests/test_debug.py::TestDebug::test_syntax_error - Failed: DID NOT RA...
FAILED tests/test_debug.py::TestDebug::test_regular_syntax_error - AssertionE...
FAILED tests/test_debug.py::TestDebug::test_pickleable_syntax_error - Attribu...
FAILED tests/test_debug.py::TestDebug::test_include_syntax_error_source - Att...
FAILED tests/test_debug.py::TestDebug::test_local_extraction - AssertionError...
FAILED tests/test_debug.py::TestDebug::test_get_corresponding_lineno_traceback
FAILED tests/test_ext.py::TestExtensions::test_extend_late - AssertionError: ...
FAILED tests/test_ext.py::TestExtensions::test_loop_controls - jinja2.excepti...
FAILED tests/test_ext.py::TestExtensions::test_do - AssertionError: assert '\...
FAILED tests/test_ext.py::TestExtensions::test_extension_nodes - AssertionErr...
FAILED tests/test_ext.py::TestExtensions::test_contextreference_node_passes_context
FAILED tests/test_ext.py::TestExtensions::test_contextreference_node_can_pass_locals
FAILED tests/test_ext.py::TestExtensions::test_rebinding - AttributeError: 'N...
FAILED tests/test_ext.py::TestExtensions::test_preprocessor_extension - Asser...
FAILED tests/test_ext.py::TestExtensions::test_streamfilter_extension - Asser...
FAILED tests/test_ext.py::TestExtensions::test_extension_ordering - TypeError...
FAILED tests/test_ext.py::TestExtensions::test_debug - assert "'context'" in ...
FAILED tests/test_ext.py::TestInternationalization::test_trans - AttributeErr...
FAILED tests/test_ext.py::TestInternationalization::test_trans_plural - Attri...
FAILED tests/test_ext.py::TestInternationalization::test_trans_plural_with_functions
FAILED tests/test_ext.py::TestInternationalization::test_complex_plural - Ass...
FAILED tests/test_ext.py::TestInternationalization::test_trans_stringformatting
FAILED tests/test_ext.py::TestInternationalization::test_trimmed - AssertionE...
FAILED tests/test_ext.py::TestInternationalization::test_trimmed_policy - Ass...
FAILED tests/test_ext.py::TestInternationalization::test_trimmed_vars - Asser...
FAILED tests/test_ext.py::TestInternationalization::test_trimmed_varname_trimmed
FAILED tests/test_ext.py::TestInternationalization::test_extract - TypeError:...
FAILED tests/test_ext.py::TestInternationalization::test_extract_trimmed - Ty...
FAILED tests/test_ext.py::TestInternationalization::test_extract_trimmed_option
FAILED tests/test_ext.py::TestInternationalization::test_comment_extract - Ty...
FAILED tests/test_ext.py::TestInternationalization::test_extract_context - Ty...
FAILED tests/test_ext.py::TestInternationalization::test_nested_trans_error
FAILED tests/test_ext.py::TestInternationalization::test_trans_block_error - ...
FAILED tests/test_ext.py::TestScope::test_basic_scope_behavior - AssertionErr...
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_trans - Attr...
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_trans_plural
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_complex_plural
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_trans_stringformatting
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_newstyle_plural
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_autoescape_support
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_num_used_twice
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_num_called_num
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_trans_vars
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_novars_vars_escaping
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_context - At...
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_context_plural
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_context_block
FAILED tests/test_ext.py::TestNewstyleInternationalization::test_context_plural_block
FAILED tests/test_ext.py::TestAutoEscape::test_scoped_setting - NameError: na...
FAILED tests/test_ext.py::TestAutoEscape::test_nonvolatile - assert ' foo="&l...
FAILED tests/test_ext.py::TestAutoEscape::test_volatile - assert ' foo="&lt;t...
FAILED tests/test_ext.py::TestAutoEscape::test_scoping - AssertionError: asse...
FAILED tests/test_ext.py::TestAutoEscape::test_volatile_scoping - AssertionEr...
FAILED tests/test_ext.py::TestAutoEscape::test_overlay_scopes - TypeError: 'i...
FAILED tests/test_filters.py::TestFilter::test_escape - AssertionError: asser...
FAILED tests/test_filters.py::TestFilter::test_striptags - AssertionError: as...
FAILED tests/test_filters.py::TestFilter::test_indent - assert '\n  foo bar\n...
FAILED tests/test_filters.py::TestFilter::test_indent_markup_input - assert '...
FAILED tests/test_filters.py::TestFilter::test_indent_width_string -   File "...
FAILED tests/test_filters.py::TestFilter::test_join - TypeError: unsupported ...
FAILED tests/test_filters.py::TestFilter::test_title - assert "Foo'S Bar" == ...
FAILED tests/test_filters.py::TestFilter::test_urlize - assert 'foo <a href=....
FAILED tests/test_filters.py::TestFilter::test_block - AssertionError: assert...
FAILED tests/test_filters.py::TestFilter::test_sort2 - TypeError: unsupported...
FAILED tests/test_filters.py::TestFilter::test_unique - TypeError: unsupporte...
FAILED tests/test_filters.py::TestFilter::test_unique_case_sensitive - jinja2...
FAILED tests/test_filters.py::TestFilter::test_groupby - jinja2.exceptions.Un...
FAILED tests/test_filters.py::TestFilter::test_groupby_tuple_index -   File "...
FAILED tests/test_filters.py::TestFilter::test_groupby_multidot - jinja2.exce...
FAILED tests/test_filters.py::TestFilter::test_groupby_default - AssertionErr...
FAILED tests/test_filters.py::TestFilter::test_groupby_case[False-a: 1, 3\nb: 2\n]
FAILED tests/test_filters.py::TestFilter::test_groupby_case[True-A: 3\na: 1\nb: 2\n]
FAILED tests/test_filters.py::TestFilter::test_filtertag - AssertionError: as...
FAILED tests/test_filters.py::TestFilter::test_replace - NameError: name 'esc...
FAILED tests/test_filters.py::TestFilter::test_forceescape - AssertionError: ...
FAILED tests/test_filters.py::TestFilter::test_safe - NameError: name 'escape...
FAILED tests/test_filters.py::TestFilter::test_urlencode[Hello, world!-Hello%2C%20world%21]
FAILED tests/test_filters.py::TestFilter::test_urlencode[Hello, world\u203d-Hello%2C%20world%E2%80%BD]
FAILED tests/test_filters.py::TestFilter::test_urlencode[value2-f=1] - NameEr...
FAILED tests/test_filters.py::TestFilter::test_urlencode[value3-f=1&amp;z=2]
FAILED tests/test_filters.py::TestFilter::test_urlencode[value4-%E2%80%BD=1]
FAILED tests/test_filters.py::TestFilter::test_urlencode[value5-0=1] - NameEr...
FAILED tests/test_filters.py::TestFilter::test_urlencode[value6-a+b%2Fc=a+b%2Fc]
FAILED tests/test_filters.py::TestFilter::test_urlencode[a b/c-a%20b/c] - Nam...
FAILED tests/test_filters.py::TestFilter::test_empty_map - TypeError: 'NoneTy...
FAILED tests/test_filters.py::TestFilter::test_filter_undefined - Failed: DID...
FAILED tests/test_filters.py::TestFilter::test_filter_undefined_in_if - KeyEr...
FAILED tests/test_filters.py::TestFilter::test_filter_undefined_in_elif - Ass...
FAILED tests/test_filters.py::TestFilter::test_filter_undefined_in_else - Key...
FAILED tests/test_filters.py::TestFilter::test_filter_undefined_in_nested_if
FAILED tests/test_filters.py::TestFilter::test_filter_undefined_in_condexpr
FAILED tests/test_idtracking.py::test_basics - AssertionError: assert {'l_0_b...
FAILED tests/test_idtracking.py::test_complex - AssertionError: assert {'rend...
FAILED tests/test_idtracking.py::test_if_branching_stores - AssertionError: a...
FAILED tests/test_idtracking.py::test_if_branching_stores_undefined - Asserti...
FAILED tests/test_idtracking.py::test_if_branching_multi_scope - AssertionErr...
FAILED tests/test_imports.py::TestImports::test_context_imports - jinja2.exce...
FAILED tests/test_imports.py::TestImports::test_import_needs_name - Failed: D...
FAILED tests/test_imports.py::TestImports::test_no_trailing_comma - Failed: D...
FAILED tests/test_imports.py::TestImports::test_trailing_comma_with_context
FAILED tests/test_imports.py::TestImports::test_exports - AttributeError: 'No...
FAILED tests/test_imports.py::TestImports::test_not_exported - AssertionError...
FAILED tests/test_imports.py::TestImports::test_import_with_globals - jinja2....
FAILED tests/test_imports.py::TestImports::test_import_with_globals_override
FAILED tests/test_imports.py::TestImports::test_from_import_with_globals - ji...
FAILED tests/test_imports.py::TestIncludes::test_context_include - AttributeE...
FAILED tests/test_imports.py::TestIncludes::test_choice_includes - AttributeE...
FAILED tests/test_imports.py::TestIncludes::test_include_ignoring_missing - A...
FAILED tests/test_imports.py::TestIncludes::test_context_include_with_overrides
FAILED tests/test_imports.py::TestIncludes::test_unoptimized_scopes - Attribu...
FAILED tests/test_imports.py::TestIncludes::test_import_from_with_context - j...
FAILED tests/test_inheritance.py::TestInheritance::test_layout - AttributeErr...
FAILED tests/test_inheritance.py::TestInheritance::test_level1 - AttributeErr...
FAILED tests/test_inheritance.py::TestInheritance::test_level2 - AttributeErr...
FAILED tests/test_inheritance.py::TestInheritance::test_level3 - AttributeErr...
FAILED tests/test_inheritance.py::TestInheritance::test_level4 - AttributeErr...
FAILED tests/test_inheritance.py::TestInheritance::test_super - AttributeErro...
FAILED tests/test_inheritance.py::TestInheritance::test_reuse_blocks - jinja2...
FAILED tests/test_inheritance.py::TestInheritance::test_preserve_blocks - Att...
FAILED tests/test_inheritance.py::TestInheritance::test_dynamic_inheritance
FAILED tests/test_inheritance.py::TestInheritance::test_multi_inheritance - A...
FAILED tests/test_inheritance.py::TestInheritance::test_scoped_block - Assert...
FAILED tests/test_inheritance.py::TestInheritance::test_super_in_scoped_block
FAILED tests/test_inheritance.py::TestInheritance::test_scoped_block_after_inheritance
FAILED tests/test_inheritance.py::TestInheritance::test_level1_required - Att...
FAILED tests/test_inheritance.py::TestInheritance::test_level2_required - Att...
FAILED tests/test_inheritance.py::TestInheritance::test_level3_required - Att...
FAILED tests/test_inheritance.py::TestInheritance::test_invalid_required - At...
FAILED tests/test_inheritance.py::TestInheritance::test_required_with_scope
FAILED tests/test_inheritance.py::TestInheritance::test_duplicate_required_or_scoped
FAILED tests/test_inheritance.py::TestBugFix::test_fixed_macro_scoping_bug - ...
FAILED tests/test_inheritance.py::TestBugFix::test_double_extends - Attribute...
FAILED tests/test_lexnparse.py::TestLexer::test_raw1 - AssertionError: assert...
FAILED tests/test_lexnparse.py::TestLexer::test_raw2 - AssertionError: assert...
FAILED tests/test_lexnparse.py::TestLexer::test_raw3 - AssertionError: assert...
FAILED tests/test_lexnparse.py::TestLexer::test_raw4 - AssertionError: assert...
FAILED tests/test_lexnparse.py::TestLexer::test_balancing -   File "<string>"...
FAILED tests/test_lexnparse.py::TestLexer::test_comments - AssertionError: as...
FAILED tests/test_lexnparse.py::TestLexer::test_string_escapes - AssertionErr...
FAILED tests/test_lexnparse.py::TestLexer::test_operators - AttributeError: '...
FAILED tests/test_lexnparse.py::TestLexer::test_name[1a-False] - Failed: DID ...
FAILED tests/test_lexnparse.py::TestLexer::test_name[a--False] - Failed: DID ...
FAILED tests/test_lexnparse.py::TestLexer::test_name[\U0001f40da-False] - Fai...
FAILED tests/test_lexnparse.py::TestLexer::test_name[a\U0001f40d\U0001f40d-False]
FAILED tests/test_lexnparse.py::TestLexer::test_name[\xb7-False] - Failed: DI...
FAILED tests/test_lexnparse.py::TestLexer::test_lineno_with_strip - TypeError...
FAILED tests/test_lexnparse.py::TestParser::test_php_syntax - AssertionError:...
FAILED tests/test_lexnparse.py::TestParser::test_erb_syntax - AssertionError:...
FAILED tests/test_lexnparse.py::TestParser::test_comment_syntax - AssertionEr...
FAILED tests/test_lexnparse.py::TestParser::test_balancing - AttributeError: ...
FAILED tests/test_lexnparse.py::TestParser::test_line_syntax - ValueError: in...
FAILED tests/test_lexnparse.py::TestParser::test_line_syntax_priority - Asser...
FAILED tests/test_lexnparse.py::TestParser::test_error_messages - Failed: DID...
FAILED tests/test_lexnparse.py::TestSyntax::test_unary - AssertionError: asse...
FAILED tests/test_lexnparse.py::TestSyntax::test_concat -   File "<string>", ...
FAILED tests/test_lexnparse.py::TestSyntax::test_django_attr -   File "<strin...
FAILED tests/test_lexnparse.py::TestSyntax::test_short_conditional_expression
FAILED tests/test_lexnparse.py::TestSyntax::test_filter_priority - KeyError: ...
FAILED tests/test_lexnparse.py::TestSyntax::test_function_calls - Failed: DID...
FAILED tests/test_lexnparse.py::TestSyntax::test_block_end_name - Failed: DID...
FAILED tests/test_lexnparse.py::TestSyntax::test_constant_casing - AssertionE...
FAILED tests/test_lexnparse.py::TestSyntax::test_test_chaining - Failed: DID ...
FAILED tests/test_lexnparse.py::TestSyntax::test_raw2 - AssertionError: asser...
FAILED tests/test_lexnparse.py::TestSyntax::test_const - AssertionError: asse...
FAILED tests/test_lexnparse.py::TestSyntax::test_neg_filter_priority - Attrib...
FAILED tests/test_lexnparse.py::TestSyntax::test_const_assign - Failed: DID N...
FAILED tests/test_lexnparse.py::TestSyntax::test_localset - AssertionError: a...
FAILED tests/test_lexnparse.py::TestSyntax::test_parse_unary - AssertionError...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip - AssertionErro...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim - Assertio...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_inline - Assert...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_nested - Assert...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_embeded_strings
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_preserve_leading_newlines
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_comment - Asser...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_angle_bracket_simple
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_angle_bracket_comment
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_angle_bracket
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_angle_bracket_compact
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_blocks_outside_with_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim_blocks_outside_with_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_blocks_inside_with_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim_blocks_inside_with_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_blocks_without_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim_blocks_without_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_blocks_consume_after_without_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim_blocks_consume_before_without_new_line
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim_blocks_comment
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_lstrip_trim_blocks_raw
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_php_syntax_with_manual
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_php_syntax - Assertion...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_php_syntax_compact - A...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_erb_syntax - Assertion...
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_erb_syntax_with_manual
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_erb_syntax_no_lstrip
FAILED tests/test_lexnparse.py::TestLstripBlocks::test_comment_syntax - Asser...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_trim - AssertionError: a...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_no_trim -   File "<strin...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_lstrip_no_trim -   File ...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_trim_blocks_false_with_no_trim
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_trim_nested - AssertionE...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_no_trim_nested -   File ...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_comment_trim - Assertion...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_comment_no_trim - Assert...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_multiple_comment_trim_lstrip
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_multiple_comment_no_trim_lstrip
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_raw_trim_lstrip - Assert...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_raw_no_trim_lstrip - Ass...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_no_trim_angle_bracket - ...
FAILED tests/test_lexnparse.py::TestTrimBlocks::test_no_trim_php_syntax -   F...
FAILED tests/test_loader.py::TestLoaders::test_dict_loader - AttributeError: ...
FAILED tests/test_loader.py::TestLoaders::test_package_loader - AttributeErro...
FAILED tests/test_loader.py::TestLoaders::test_choice_loader - AttributeError...
FAILED tests/test_loader.py::TestLoaders::test_function_loader - AttributeErr...
FAILED tests/test_loader.py::TestLoaders::test_prefix_loader - AttributeError...
FAILED tests/test_loader.py::TestLoaders::test_caching - AssertionError: asse...
FAILED tests/test_loader.py::TestLoaders::test_no_cache - AssertionError: ass...
FAILED tests/test_loader.py::TestLoaders::test_limited_size_cache - Assertion...
FAILED tests/test_loader.py::TestLoaders::test_cache_loader_change - Attribut...
FAILED tests/test_loader.py::TestLoaders::test_dict_loader_cache_invalidates
FAILED tests/test_loader.py::TestFileSystemLoader::test_searchpath_as_str - A...
FAILED tests/test_loader.py::TestFileSystemLoader::test_searchpath_as_pathlib
FAILED tests/test_loader.py::TestFileSystemLoader::test_searchpath_as_list_including_pathlib
FAILED tests/test_loader.py::TestFileSystemLoader::test_caches_template_based_on_mtime
FAILED tests/test_loader.py::TestFileSystemLoader::test_uses_specified_encoding[utf-8-\u6587\u5b57\u5316\u3051]
FAILED tests/test_loader.py::TestFileSystemLoader::test_uses_specified_encoding[iso-8859-1-\xe6\x96\x87\xe5\xad\x97\xe5\x8c\x96\xe3\x81\x91]
FAILED tests/test_loader.py::TestFileSystemLoader::test_filename_normpath - A...
FAILED tests/test_loader.py::TestModuleLoader::test_log - assert 'Compiled "a...
FAILED tests/test_loader.py::TestModuleLoader::test_deflated_zip_compile - At...
FAILED tests/test_loader.py::TestModuleLoader::test_stored_zip_compile - Attr...
FAILED tests/test_loader.py::TestModuleLoader::test_filesystem_compile - Attr...
FAILED tests/test_loader.py::TestModuleLoader::test_weak_references - Attribu...
FAILED tests/test_loader.py::TestModuleLoader::test_choice_loader - Attribute...
FAILED tests/test_loader.py::TestModuleLoader::test_prefix_loader - Attribute...
FAILED tests/test_loader.py::TestModuleLoader::test_path_as_pathlib - Attribu...
FAILED tests/test_loader.py::TestModuleLoader::test_supports_pathlib_in_list_of_paths
FAILED tests/test_loader.py::test_package_zip_source[foo/test.html-FOO] - jin...
FAILED tests/test_loader.py::test_package_zip_source[test.html-BAR] - jinja2....
FAILED tests/test_loader.py::test_package_zip_list - AssertionError: assert [...
FAILED tests/test_loader.py::test_package_zip_omit_curdir[] - jinja2.exceptio...
FAILED tests/test_loader.py::test_package_zip_omit_curdir[.] - AssertionError...
FAILED tests/test_loader.py::test_package_zip_omit_curdir[./] - AssertionErro...
FAILED tests/test_nativetypes.py::test_undefined_native_return - AssertionErr...
FAILED tests/test_nativetypes.py::test_booleans[{{ None is none }}-True] - Ke...
FAILED tests/test_nativetypes.py::test_variable_dunder - assert False
FAILED tests/test_nativetypes.py::test_constant_dunder - assert False
FAILED tests/test_nativetypes.py::test_macro - assert [1, 2] == 2
FAILED tests/test_regression.py::TestCorner::test_assigned_scoping - Assertio...
FAILED tests/test_regression.py::TestCorner::test_closure_scoping - TypeError...
FAILED tests/test_regression.py::TestBug::test_extends_output_bugs - Assertio...
FAILED tests/test_regression.py::TestBug::test_loop_call_loop - jinja2.except...
FAILED tests/test_regression.py::TestBug::test_weird_inline_comment - Failed:...
FAILED tests/test_regression.py::TestBug::test_partial_conditional_assignments
FAILED tests/test_regression.py::TestBug::test_stacked_locals_scoping_bug - a...
FAILED tests/test_regression.py::TestBug::test_stacked_locals_scoping_bug_twoframe
FAILED tests/test_regression.py::TestBug::test_call_with_args - jinja2.except...
FAILED tests/test_regression.py::TestBug::test_empty_if_condition_fails - Fai...
FAILED tests/test_regression.py::TestBug::test_else_loop_bug - jinja2.excepti...
FAILED tests/test_regression.py::TestBug::test_correct_prefix_loader_name - F...
FAILED tests/test_regression.py::TestBug::test_pass_context_callable_class - ...
FAILED tests/test_regression.py::TestBug::test_block_set_with_extends - Asser...
FAILED tests/test_regression.py::TestBug::test_nested_for_else - jinja2.excep...
FAILED tests/test_regression.py::TestBug::test_callable_defaults - jinja2.exc...
FAILED tests/test_regression.py::TestBug::test_macro_scoping - jinja2.excepti...
FAILED tests/test_regression.py::TestBug::test_scopes_and_blocks - AttributeE...
FAILED tests/test_regression.py::TestBug::test_scopes_and_include - Attribute...
FAILED tests/test_regression.py::TestBug::test_caller_scoping - AttributeErro...
FAILED tests/test_regression.py::TestBug::test_variable_reuse - jinja2.except...
FAILED tests/test_regression.py::TestBug::test_double_caller - jinja2.excepti...
FAILED tests/test_regression.py::TestBug::test_double_caller_no_default - Fai...
FAILED tests/test_regression.py::TestBug::test_scoped_block - AssertionError:...
FAILED tests/test_regression.py::TestBug::test_recursive_loop_filter - jinja2...
FAILED tests/test_regression.py::TestBug::test_subproperty_if -   File "<stri...
FAILED tests/test_regression.py::TestBug::test_set_and_include - AttributeErr...
FAILED tests/test_regression.py::TestBug::test_loop_include - AttributeError:...
FAILED tests/test_regression.py::TestBug::test_custom_context - AttributeErro...
FAILED tests/test_regression.py::TestBug::test_recursive_loop_bug -   File "<...
FAILED tests/test_regression.py::TestBug::test_scoped_block_loop_vars - jinja...
FAILED tests/test_regression.py::TestBug::test_pass_context_loop_vars - jinja...
FAILED tests/test_regression.py::TestBug::test_pass_context_scoped_loop_vars
FAILED tests/test_regression.py::TestBug::test_pass_context_in_blocks - TypeE...
FAILED tests/test_regression.py::TestBug::test_pass_context_block_and_loop - ...
FAILED tests/test_regression.py::TestBug::test_cached_extends[extends] - Attr...
FAILED tests/test_regression.py::TestBug::test_cached_extends[include] - Attr...
FAILED tests/test_runtime.py::test_loop_idx - jinja2.exceptions.UndefinedErro...
FAILED tests/test_runtime.py::test_loop_idx0 - jinja2.exceptions.UndefinedErr...
FAILED tests/test_runtime.py::test_iterator_not_advanced_early - jinja2.excep...
FAILED tests/test_security.py::TestSandbox::test_unsafe - Failed: DID NOT RAI...
FAILED tests/test_security.py::TestSandbox::test_immutable_environment - Fail...
FAILED tests/test_security.py::TestSandbox::test_restricted - Failed: DID NOT...
FAILED tests/test_security.py::TestSandbox::test_template_data - NameError: n...
FAILED tests/test_security.py::TestSandbox::test_attr_filter -   File "<strin...
FAILED tests/test_security.py::TestSandbox::test_binary_operator_intercepting
FAILED tests/test_security.py::TestSandbox::test_unary_operator_intercepting
FAILED tests/test_security.py::TestStringFormat::test_basic_format_safety - a...
FAILED tests/test_security.py::TestStringFormat::test_basic_format_all_okay
FAILED tests/test_security.py::TestStringFormat::test_safe_format_safety - Ty...
FAILED tests/test_security.py::TestStringFormat::test_safe_format_all_okay - ...
FAILED tests/test_security.py::TestStringFormat::test_empty_braces_format - T...
FAILED tests/test_security.py::TestStringFormatMap::test_basic_format_safety
FAILED tests/test_security.py::TestStringFormatMap::test_basic_format_all_okay
FAILED tests/test_security.py::TestStringFormatMap::test_safe_format_all_okay
FAILED tests/test_tests.py::TestTestsCase::test_types[none is none-True] - Ke...
FAILED tests/test_tests.py::TestTestsCase::test_types[false is none-False] - ...
FAILED tests/test_tests.py::TestTestsCase::test_types[true is none-False] - K...
FAILED tests/test_tests.py::TestTestsCase::test_types[42 is none-False] - Key...
FAILED tests/test_tests.py::TestTestsCase::test_types[none is true-False] - K...
FAILED tests/test_tests.py::TestTestsCase::test_types[false is true-False] - ...
FAILED tests/test_tests.py::TestTestsCase::test_types[true is true-True] - Ke...
FAILED tests/test_tests.py::TestTestsCase::test_types[0 is true-False] - KeyE...
FAILED tests/test_tests.py::TestTestsCase::test_types[1 is true-False] - KeyE...
FAILED tests/test_tests.py::TestTestsCase::test_types[42 is true-False] - Key...
FAILED tests/test_tests.py::TestTestsCase::test_types[none is false-False] - ...
FAILED tests/test_tests.py::TestTestsCase::test_types[false is false-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_types[true is false-False] - ...
FAILED tests/test_tests.py::TestTestsCase::test_types[0 is false-False] - Key...
FAILED tests/test_tests.py::TestTestsCase::test_types[1 is false-False] - Key...
FAILED tests/test_tests.py::TestTestsCase::test_types[42 is false-False] - Ke...
FAILED tests/test_tests.py::TestTestsCase::test_equalto -   File "<string>", ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[eq 2-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[eq 3-False]
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[ne 3-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[ne 2-False]
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[lt 3-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[lt 2-False]
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[le 2-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[le 1-False]
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[gt 1-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[gt 2-False]
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[ge 2-True] - ...
FAILED tests/test_tests.py::TestTestsCase::test_compare_aliases[ge 3-False]
FAILED tests/test_tests.py::TestTestsCase::test_sameas -   File "<string>", l...
FAILED tests/test_tests.py::TestTestsCase::test_no_paren_for_arg1 -   File "<...
FAILED tests/test_tests.py::TestTestsCase::test_escaped - NameError: name 'es...
FAILED tests/test_tests.py::TestTestsCase::test_greaterthan -   File "<string...
FAILED tests/test_tests.py::TestTestsCase::test_lessthan -   File "<string>",...
FAILED tests/test_tests.py::TestTestsCase::test_multiple_tests -   File "<str...
FAILED tests/test_tests.py::TestTestsCase::test_in -   File "<string>", line 1
FAILED tests/test_tests.py::test_name_undefined - Failed: DID NOT RAISE <clas...
FAILED tests/test_tests.py::test_name_undefined_in_if - KeyError: 'f'
FAILED tests/test_utils.py::TestLRUCache::test_simple - AssertionError: asser...
FAILED tests/test_utils.py::TestLRUCache::test_values - assert [1, 2] == [2, 1]
FAILED tests/test_utils.py::TestLRUCache::test_copy[copy0] - AssertionError: ...
FAILED tests/test_utils.py::TestLRUCache::test_copy[copy1] - AssertionError: ...
FAILED tests/test_utils.py::TestLRUCache::test_items - AssertionError: assert...
FAILED tests/test_utils.py::TestHelpers::test_object_type_repr - AssertionErr...
FAILED tests/test_utils.py::TestLoremIpsum::test_lorem_ipsum_markup - Asserti...
FAILED tests/test_utils.py::TestLoremIpsum::test_lorem_ipsum_max - AssertionE...
ERROR tests/test_async.py::test_await_on_calls_normal_render - pytest.PytestU...
ERROR tests/test_async_filters.py::test_custom_async_filter - exceptiongroup....
ERROR tests/test_async_filters.py::test_custom_async_iteratable_filter[<lambda>0]
ERROR tests/test_async_filters.py::test_custom_async_iteratable_filter[<lambda>1]
================== 498 failed, 353 passed, 4 errors in 13.26s ==================