diff options
author | Simon Feltman <sfeltman@src.gnome.org> | 2013-05-11 21:47:54 -0700 |
---|---|---|
committer | Simon Feltman <sfeltman@src.gnome.org> | 2013-05-12 23:14:15 -0700 |
commit | 02ae144067561f74e71bb7690d058de4852187bd (patch) | |
tree | cd7b6d10e01a0a901440f4bc4669c7a831ce808d | |
parent | a760eae17e550940867d17ea890eb8254267f53d (diff) | |
download | pygobject-02ae144067561f74e71bb7690d058de4852187bd.tar.gz |
tests: Add tests for overriding vfunc implementations
Add tests for overriding vfuncs for both single inheritance
and multiple inheritance with an interface (currently failing).
https://bugzilla.gnome.org/show_bug.cgi?id=700092
-rw-r--r-- | tests/test_gi.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_gi.py b/tests/test_gi.py index 26715885..33a77ab5 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -2074,6 +2074,9 @@ class TestPythonGObject(unittest.TestCase): def do_method_with_default_implementation(self, int8): self.val = int8 + def do_vfunc_return_value_only(self): + return 2121 + class Interface3Impl(GObject.Object, GIMarshallingTests.Interface3): def __init__(self): GObject.Object.__init__(self) @@ -2147,6 +2150,10 @@ class TestPythonGObject(unittest.TestCase): object_.method_with_default_implementation(87) self.assertEqual(object_.val, 87) + def test_subobject_child_vfunc(self): + object_ = self.SubObject(int=1) + self.assertEqual(object_.vfunc_return_value_only(), 2121) + def test_dynamic_module(self): from gi.module import DynamicModule self.assertTrue(isinstance(GObject, DynamicModule)) @@ -2288,6 +2295,22 @@ class TestInterfaces(unittest.TestCase): GIMarshallingTests.test_interface_test_int8_in(instance, 42) self.assertEqual(instance.val, 42) + @unittest.expectedFailure # https://bugzilla.gnome.org/show_bug.cgi?id=700092 + def test_subclass_override(self): + class TestInterfaceImplD(TestInterfaces.TestInterfaceImpl): + val2 = None + + def do_test_int8_in(self, int8): + self.val2 = int8 + + instance = TestInterfaceImplD() + self.assertEqual(instance.val, None) + self.assertEqual(instance.val2, None) + + GIMarshallingTests.test_interface_test_int8_in(instance, 42) + self.assertEqual(instance.val, None) + self.assertEqual(instance.val2, 42) + def test_mro(self): # there was a problem with Python bailing out because of # http://en.wikipedia.org/wiki/Diamond_problem with interfaces, |