Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Clean up tests, we don't need a C binding to access tp_basicsize, cle…
…an up * tests/test_subtype.py: * tests/testhelpermodule.c: (test_type_get_type), (_wrap_get_unknown), (_wrap_test_g_object_new), (inittesthelper): Clean up tests, we don't need a C binding to access tp_basicsize, clean up the C tests, quite a bit aswell.
- Loading branch information
Johan Dahlin
committed
Jul 25, 2005
1 parent
989d70c
commit 3887e4c
Showing
2 changed files
with
55 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,42 @@ | ||
import unittest | ||
|
||
from common import gobject, gtk, testhelper | ||
import testmodule | ||
from common import gobject, gtk, testhelper | ||
from gobject import GObject, GInterface | ||
|
||
class TestSubType(unittest.TestCase): | ||
def testSubType(self): | ||
t = type('testtype', (gobject.GObject, gobject.GInterface), {}) | ||
self.assert_(issubclass(t, gobject.GObject)) | ||
self.assert_(issubclass(t, gobject.GInterface)) | ||
t = type('testtype2', (gobject.GObject, gtk.TreeModel), {}) | ||
self.assert_(issubclass(t, gobject.GObject)) | ||
self.assert_(issubclass(t, gtk.TreeModel)) | ||
|
||
def testTpBasicSize(self): | ||
iface = testhelper.get_tp_basicsize(gobject.GInterface) | ||
gobj = testhelper.get_tp_basicsize(gobject.GObject) | ||
t = type('testtype', (GObject, GInterface), {}) | ||
self.failUnless(issubclass(t, GObject)) | ||
self.failUnless(issubclass(t, GInterface)) | ||
t = type('testtype2', (GObject, gtk.TreeModel), {}) | ||
self.failUnless(issubclass(t, GObject)) | ||
self.failUnless(issubclass(t, gtk.TreeModel)) | ||
|
||
widget = testhelper.get_tp_basicsize(gtk.Widget) | ||
self.assert_(gobj == widget) | ||
|
||
treemodel = testhelper.get_tp_basicsize(gtk.TreeModel) | ||
self.assert_(iface == treemodel) | ||
|
||
def testBuiltinContructorRefcount(self): | ||
foo = gtk.Label() | ||
self.assertEqual(foo.__grefcount__, 1) | ||
|
||
def testPyContructorRefcount(self): | ||
foo = testmodule.PyLabel() | ||
self.assertEqual(foo.__grefcount__, 1) | ||
|
||
def testBuiltinObjNewRefcount(self): | ||
foo = gobject.new(gtk.Label) | ||
self.assertEqual(foo.__grefcount__, 1) | ||
|
||
def testPyObjNewRefcount(self): | ||
foo = gobject.new(testmodule.PyLabel) | ||
self.assertEqual(foo.__grefcount__, 1) | ||
|
||
def testPyContructorPropertyChaining(self): | ||
foo = testmodule.PyLabel() | ||
self.assertEqual(foo.__grefcount__, 1) | ||
|
||
def testPyObjNewPropertyChaining(self): | ||
foo = gobject.new(testmodule.PyLabel) | ||
self.assertEqual(foo.props.label, "hello") | ||
|
||
def testCPyCSubclassing1(self): | ||
def testTpBasicSize(self): | ||
self.assertEqual(GObject.__basicsize__, | ||
gtk.Widget.__basicsize__) | ||
|
||
self.assertEqual(GInterface.__basicsize__, | ||
gtk.TreeModel.__basicsize__) | ||
|
||
def testLabel(self): | ||
label = gtk.Label() | ||
self.assertEqual(label.__grefcount__, 1) | ||
label = gobject.new(gtk.Label) | ||
self.assertEqual(label.__grefcount__, 1) | ||
|
||
def testPythonSubclass(self): | ||
label = testmodule.PyLabel() | ||
self.assertEqual(label.__grefcount__, 1) | ||
self.assertEqual(label.props.label, "hello") | ||
label = gobject.new(testmodule.PyLabel) | ||
self.assertEqual(label.__grefcount__, 1) | ||
self.assertEqual(label.props.label, "hello") | ||
|
||
def testCPyCSubclassing(self): | ||
obj = testhelper.create_test_type() | ||
self.assertEqual(obj.__grefcount__, 1) | ||
|
||
def testCPyCSubclassing1(self): | ||
refcount = testhelper.test_g_object_new() | ||
self.assertEqual(refcount, 2) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters