diff options
author | David Lord <davidism@gmail.com> | 2020-03-30 10:54:57 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-03-30 10:54:57 -0700 |
commit | c074fd5ecb7af70b2f864c9ef545fffd38dc203b (patch) | |
tree | ba581aaf77613e5b3119af11ceca7a935a25f6db /tests | |
parent | b3a9df307220fc88c2bde48da5ff837a33faff31 (diff) | |
parent | 07b5c01338bbfc06be9afc80a127a327611d9a6d (diff) | |
download | jinja2-c074fd5ecb7af70b2f864c9ef545fffd38dc203b.tar.gz |
Merge branch '2.11.x'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_api.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/test_api.py b/tests/test_api.py index 0655c47..2679e8f 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -267,6 +267,21 @@ class TestUndefined: with pytest.raises(AttributeError): Undefined("Foo").__dict__ + def test_undefined_attribute_error(self): + # Django's LazyObject turns the __class__ attribute into a + # property that resolves the wrapped function. If that wrapped + # function raises an AttributeError, printing the repr of the + # object in the undefined message would cause a RecursionError. + class Error: + @property + def __class__(self): + raise AttributeError() + + u = Undefined(obj=Error(), name="hello") + + with pytest.raises(UndefinedError): + getattr(u, "recursion", None) + def test_logging_undefined(self): _messages = [] |