[pygobject] Add some GType tests



commit 5c0b20cc1a261cb7430a5251dffe60da698033b5
Author: Paolo Borelli <pborelli gnome org>
Date:   Thu Feb 9 18:15:42 2012 +0100

    Add some GType tests
    
    Use what was recently added in g-i

 tests/test_gi.py |   17 +++++++++++++++--
 1 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 363b286..f762f74 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -598,16 +598,29 @@ class TestDouble(unittest.TestCase):
 
 class TestGType(unittest.TestCase):
 
+    def test_gtype_name(self):
+        self.assertEquals("void", GObject.TYPE_NONE.name)
+        self.assertEquals("gchararray", GObject.TYPE_STRING.name)
+
+        def check_readonly(gtype):
+            gtype.name = "foo"
+
+        self.assertRaises(AttributeError, check_readonly, GObject.TYPE_NONE)
+        self.assertRaises(AttributeError, check_readonly, GObject.TYPE_STRING)
+
     def test_gtype_return(self):
         self.assertEquals(GObject.TYPE_NONE, GIMarshallingTests.gtype_return())
+        self.assertEquals(GObject.TYPE_STRING, GIMarshallingTests.gtype_string_return())
 
     def test_gtype_in(self):
         GIMarshallingTests.gtype_in(GObject.TYPE_NONE)
-
-        self.assertRaises(TypeError, GIMarshallingTests.gtype_in, "GObject.TYPE_NONE")
+        GIMarshallingTests.gtype_string_in(GObject.TYPE_STRING)
+        self.assertRaises(TypeError, GIMarshallingTests.gtype_in, "foo")
+        self.assertRaises(TypeError, GIMarshallingTests.gtype_string_in, "foo")
 
     def test_gtype_out(self):
         self.assertEquals(GObject.TYPE_NONE, GIMarshallingTests.gtype_out())
+        self.assertEquals(GObject.TYPE_STRING, GIMarshallingTests.gtype_string_out())
 
     def test_gtype_inout(self):
         self.assertEquals(GObject.TYPE_INT, GIMarshallingTests.gtype_inout(GObject.TYPE_NONE))



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]