diff options
author | Johan Dahlin <johan@src.gnome.org> | 2004-07-28 14:25:57 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2004-07-28 14:25:57 +0000 |
commit | a0443783c880cf90b11886e3180e842e2c17a77a (patch) | |
tree | 938ef5ea44527c8d3a90d29e2be30c8f53792585 | |
parent | 207489d4171eb275fe0c2b54cfcf092bdba6406a (diff) | |
download | pygobject-a0443783c880cf90b11886e3180e842e2c17a77a.tar.gz |
Test various other types aswell
-rw-r--r-- | tests/gtype.py | 55 |
1 files changed, 48 insertions, 7 deletions
diff --git a/tests/gtype.py b/tests/gtype.py index b1091020..a20a2e8e 100644 --- a/tests/gtype.py +++ b/tests/gtype.py @@ -3,13 +3,54 @@ import unittest from common import gobject, gtk class GTypeTest(unittest.TestCase): - def testBoolType(self): - store = gtk.ListStore(gobject.TYPE_BOOLEAN) - assert store.get_column_type(0) == gobject.TYPE_BOOLEAN - store = gtk.ListStore('gboolean') - assert store.get_column_type(0) == gobject.TYPE_BOOLEAN - store = gtk.ListStore(bool) - assert store.get_column_type(0) == gobject.TYPE_BOOLEAN + def checkType(self, expected, *objects): + # Silly method to check pyg_type_from_object + + store = gtk.ListStore(expected) + val = store.get_column_type(0) + assert val == expected, \ + 'got %r while %r was expected' % (val, expected) + for object in objects: + store = gtk.ListStore(object) + val = store.get_column_type(0) + assert val == expected, \ + 'got %r while %r was expected' % (val, expected) + + def testBool(self): + self.checkType(gobject.TYPE_BOOLEAN, 'gboolean', bool) + + def testInt(self): + self.checkType(gobject.TYPE_INT, 'gint', int) + + def testInt64(self): + self.checkType(gobject.TYPE_INT64, 'gint64') + + def testUint(self): + self.checkType(gobject.TYPE_UINT, 'guint') + + def testUint64(self): + self.checkType(gobject.TYPE_UINT64, 'guint64') + + def testLong(self): + self.checkType(gobject.TYPE_LONG, 'glong', long) + + def testUlong(self): + self.checkType(gobject.TYPE_ULONG, 'gulong') + + def testDouble(self): + self.checkType(gobject.TYPE_DOUBLE, 'gdouble', float) + + def testFloat(self): + self.checkType(gobject.TYPE_FLOAT, 'gfloat') + + def testPyObject(self): + self.checkType(gobject.TYPE_PYOBJECT, object) + + def testObject(self): + self.checkType(gobject.TYPE_OBJECT) + + # XXX: Flags, Enums + if __name__ == '__main__': unittest.main() |