summaryrefslogtreecommitdiffstats
path: root/tests/test_gtype.py
diff options
context:
space:
mode:
authorGian Mario Tagliaretti <gianmt@gnome.org>2010-04-05 18:10:42 +0200
committerGian Mario Tagliaretti <gianmt@gnome.org>2010-04-05 18:10:42 +0200
commit4cbd9941c5705970a9f7a429e236e1203d3155a1 (patch)
tree3c6675decfc6c59a6162a8ccc739be88517ea1b2 /tests/test_gtype.py
parent23fc0f615d87994acafd9d39e92dd92b587fc2eb (diff)
downloadpygobject-4cbd9941c5705970a9f7a429e236e1203d3155a1.tar.gz
pygobject-4cbd9941c5705970a9f7a429e236e1203d3155a1.tar.xz
pygobject-4cbd9941c5705970a9f7a429e236e1203d3155a1.zip
Bug 613341 - pygobject tests seem to require pygtk causing a circular
dependencies problem move tests that require pygtk to pygtk itself
Diffstat (limited to 'tests/test_gtype.py')
-rw-r--r--tests/test_gtype.py112
1 files changed, 0 insertions, 112 deletions
diff --git a/tests/test_gtype.py b/tests/test_gtype.py
deleted file mode 100644
index cd1b140..0000000
--- a/tests/test_gtype.py
+++ /dev/null
@@ -1,112 +0,0 @@
-import unittest
-
-from gobject import GType
-from common import gobject, testhelper
-
-def raiseGError():
- err = gobject.GError
- err.message = "Test conversion between exception and GError"
- err.code = 1
- err.domain = ""
- raise err
-
-def test_raiseGError():
- testhelper.test_gerror_exception(raiseGError)
-
-class GTypeTest(unittest.TestCase):
- 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 assertPyType(self, val, pytype):
- val.pytype = pytype
- self.assertEqual(val.pytype, pytype,
- 'got %r while %r was expected' % (val.pytype, pytype))
-
- def setInvalidPyType(self):
- val = GType(gobject.TYPE_INT)
- val.pytype = 1
-
- def testBool(self):
- self.checkType(gobject.TYPE_BOOLEAN, 'gboolean', bool)
-
- def testInt(self):
- self.checkType(gobject.TYPE_INT, 'gint', int)
- # model = gtk.ListStore(str, int)
- # iter = model.append()
- # model.set(iter, 1, 100000000)
-
- 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, 'GObject', object)
-
- def testObject(self):
- self.checkType(gobject.TYPE_OBJECT, 'PyObject')
-
- 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 testInvalidPyType(self):
- self.assertRaises(TypeError, self.setInvalidPyType)
-
- def testValue(self):
- array = [1, "foo", True]
- for i in array:
- self.assertEqual(i, testhelper.test_value(i))
-
- def testValueArray(self):
- array = [1, 2, 3, "foo", True]
- self.assertEqual(array, testhelper.test_value_array(array))
-
- def testValueArrayNone(self):
- array = [1, 2, 3, "foo", True, None]
- self.assertEqual(array, testhelper.test_value_array(array))
-
- def testGError(self):
- self.assertRaises(gobject.GError, test_raiseGError)
-
- # XXX: Flags, Enums
-
-class MyObject(gobject.GObject):
- __gtype_name__ = 'MyObject'
-
-class TypeNameTest(unittest.TestCase):
- def testTypeName(self):
- self.assertEqual(GType(MyObject).name, 'MyObject')
-
-if __name__ == '__main__':
- unittest.main()