Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 5f0e130026
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (32 sloc) 1.051 kb
# -*- Mode: Python -*-
import unittest
import gobject
import testhelper
GUnknown = gobject.type_from_name("TestUnknown")
Unknown = GUnknown.pytype
class MyUnknown(Unknown, testhelper.Interface):
some_property = gobject.property(type=str)
def __init__(self):
Unknown.__init__(self)
self.called = False
def do_iface_method(self):
self.called = True
Unknown.do_iface_method(self)
gobject.type_register(MyUnknown)
class MyObject(gobject.GObject, testhelper.Interface):
some_property = gobject.property(type=str)
def __init__(self):
gobject.GObject.__init__(self)
self.called = False
def do_iface_method(self):
self.called = True
gobject.type_register(MyObject)
class TestIfaceImpl(unittest.TestCase):
def testReImplementInterface(self):
m = MyUnknown()
m.iface_method()
self.assertEqual(m.called, True)
def testImplementInterface(self):
m = MyObject()
m.iface_method()
self.assertEqual(m.called, True)
Jump to Line
Something went wrong with that request. Please try again.