summaryrefslogtreecommitdiff
path: root/tests/test_support.py
diff options
context:
space:
mode:
authorNikiforov Konstantin <kostya.nik.3854@gmail.com>2020-09-30 20:17:16 +0500
committerGitHub <noreply@github.com>2020-09-30 18:17:16 +0300
commit044416707f9effbe77582779a09ae9e37a0f6ffd (patch)
tree3320fb9aa691b9d247706ac58bff02a8b6a77349 /tests/test_support.py
parente0e6aa614546855ccb76637b8d910382b6e94dba (diff)
downloadbabel-044416707f9effbe77582779a09ae9e37a0f6ffd.tar.gz
LazyProxy: Handle AttributeError in specified func (#724)
Fixes #723 Co-authored-by: Aarni Koskela <akx@iki.fi>
Diffstat (limited to 'tests/test_support.py')
-rw-r--r--tests/test_support.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_support.py b/tests/test_support.py
index b4dd823..1b74ae8 100644
--- a/tests/test_support.py
+++ b/tests/test_support.py
@@ -279,6 +279,17 @@ class LazyProxyTestCase(unittest.TestCase):
self.assertEqual(2, proxy.value)
self.assertEqual(1, proxy_deepcopy.value)
+ def test_handle_attribute_error(self):
+
+ def raise_attribute_error():
+ raise AttributeError('message')
+
+ proxy = support.LazyProxy(raise_attribute_error)
+ with pytest.raises(AttributeError) as exception:
+ proxy.value
+
+ self.assertEqual('message', str(exception.value))
+
def test_format_date():
fmt = support.Format('en_US')