[pygobject] tests: Add failing tests which verify exceptions raised in property getters



commit b1caef95c4b68b65f3f159563162afde5a0b0939
Author: Simon Feltman <sfeltman src gnome org>
Date:   Sat Aug 9 02:14:23 2014 -0700

    tests: Add failing tests which verify exceptions raised in property getters
    
    https://bugzilla.gnome.org/show_bug.cgi?id=575652

 tests/test_properties.py |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/tests/test_properties.py b/tests/test_properties.py
index c9c75c2..9138361 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -529,6 +529,23 @@ class TestProperty(unittest.TestCase):
         self.assertEqual(o.prop, 'value')
         self.assertRaises(TypeError, setattr, o, 'prop', 'xxx')
 
+    @unittest.expectedFailure  # https://bugzilla.gnome.org/show_bug.cgi?id=575652
+    def test_getter_exception(self):
+        class C(GObject.Object):
+            @GObject.Property(type=int)
+            def prop(self):
+                raise ValueError('something bad happend')
+
+        o = C()
+        with self.assertRaisesRegex(ValueError, 'something bad happend'):
+            o.prop
+
+        with self.assertRaisesRegex(ValueError, 'something bad happend'):
+            o.get_property('prop')
+
+        with self.assertRaisesRegex(ValueError, 'something bad happend'):
+            o.props.prop
+
     def test_custom_setter(self):
         class C(GObject.GObject):
             def set_prop(self, value):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]