summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorAnubhav Joshi <anubhav9042@gmail.com>2014-07-26 16:30:54 +0530
committerTim Graham <timograham@gmail.com>2014-07-31 09:13:55 -0400
commit0dd05c9e66ebb5cb97136f84373f43582783e1a6 (patch)
tree6a84f8e6ccfe011ff9a91ddfe443088fc6104417 /tests
parent9d9f0acd7e245c9f9c30727a003666618754c924 (diff)
Fixed #16383 -- Raised the AttributeError raised in property of an object when used in a template.
Thanks maraujop for the report and Hiroki and Tim Graham for review.
Diffstat (limited to 'tests')
-rw-r--r--tests/template_tests/tests.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/template_tests/tests.py b/tests/template_tests/tests.py
index 0d83f38950..d5ee85fce2 100644
--- a/tests/template_tests/tests.py
+++ b/tests/template_tests/tests.py
@@ -110,13 +110,17 @@ class SomeClass:
raise SomeOtherException
raise KeyError
+ @property
def silent_fail_attribute(self):
raise SomeException
- silent_fail_attribute = property(silent_fail_attribute)
+ @property
def noisy_fail_attribute(self):
raise SomeOtherException
- noisy_fail_attribute = property(noisy_fail_attribute)
+
+ @property
+ def attribute_error_attribute(self):
+ raise AttributeError
class OtherClass:
@@ -820,6 +824,9 @@ class TemplateTests(TestCase):
'filter-syntax23': (r'1{{ var.noisy_fail_key }}2', {"var": SomeClass()}, (SomeOtherException, SomeOtherException)),
'filter-syntax24': (r'1{{ var.noisy_fail_attribute }}2', {"var": SomeClass()}, (SomeOtherException, SomeOtherException)),
+ # #16383 - A @property that raises AttributeError should not fail loudly.
+ 'filter-syntax25': ('{{ var.attribute_error_attribute }}', {"var": SomeClass()}, (AttributeError)),
+
### COMMENT SYNTAX ########################################################
'comment-syntax01': ("{# this is hidden #}hello", {}, "hello"),
'comment-syntax02': ("{# this is hidden #}hello{# foo #}", {}, "hello"),