summaryrefslogtreecommitdiff
path: root/tests/test_source.py
diff options
context:
space:
mode:
authorSimon Feltman <sfeltman@src.gnome.org>2013-09-11 05:05:33 -0700
committerSimon Feltman <sfeltman@src.gnome.org>2013-09-11 05:05:33 -0700
commit59a2964141e963d2961e55d4b84a777927b4f21b (patch)
tree0d179f5a0f51787323221518bf30c44e088b7c7c /tests/test_source.py
parentafa42ab95327da1de0cf86005974cd8ab0d46872 (diff)
downloadpygobject-59a2964141e963d2961e55d4b84a777927b4f21b.tar.gz
Fix GLib.Source sub-classing with initializer args
Add variable args and keyword args to the GLib.Source.__new__ method to support sub-classes which want to implement __init__. https://bugzilla.gnome.org/show_bug.cgi?id=707904
Diffstat (limited to 'tests/test_source.py')
-rw-r--r--tests/test_source.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_source.py b/tests/test_source.py
index 5b3b51ba..d0e28e4e 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -214,6 +214,17 @@ class TestSource(unittest.TestCase):
del source
self.assertTrue(self.finalized)
+ def test_extra_init_args(self):
+ class SourceWithInitArgs(GLib.Source):
+ def __init__(self, arg, kwarg=None):
+ super(SourceWithInitArgs, self).__init__()
+ self.arg = arg
+ self.kwarg = kwarg
+
+ source = SourceWithInitArgs(1, kwarg=2)
+ self.assertEqual(source.arg, 1)
+ self.assertEqual(source.kwarg, 2)
+
class TestUserData(unittest.TestCase):
def test_idle_no_data(self):