def checkType(self, expected, *objects): # First, double check so we get back what we sent str = GType(expected).name # pyg_type_from_object val = GType.from_name(str) # pyg_type_wrapper_new self.assertEqual(val, expected, 'got %r while %r was expected' % (val, expected)) # Then test the objects for object in objects: val = GType.from_name(GType(expected).name) self.assertEqual(val, expected, 'got %r while %r was expected' % (val, expected))
def testIterator(self): for obj in (PropertyObject.props, PropertyObject().props): for pspec in obj: gtype = GType(pspec) self.assertEqual(gtype.parent.name, 'GParam') self.failUnless(pspec.name in [ 'normal', 'construct', 'construct-only', 'uint64', 'enum' ]) self.assertEqual(len(obj), 5)
def testPyType(self): val = GType(gobject.TYPE_INT) self.assertEqual(val.pytype, None, 'got %r while %r was expected' % (val.pytype, None)) for t in [int, None, float]: self.assertPyType(val, t)
def setInvalidPyType(self): val = GType(gobject.TYPE_INT) val.pytype = 1
def testTypeName(self): self.assertEqual(GType(MyObject).name, 'MyObject')