summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2006-04-11 14:11:09 +0000
committerJohan Dahlin <johan@src.gnome.org>2006-04-11 14:11:09 +0000
commitd775961664e4755481ef01c192ea8b8d27cf7567 (patch)
tree60beef30983edffbc29f74db19ef6163ee743f33 /tests
parentbe8d076bbafd3bb5f26fa8716ff6e898b76b1d1a (diff)
downloadpygobject-d775961664e4755481ef01c192ea8b8d27cf7567.tar.gz
pygobject-d775961664e4755481ef01c192ea8b8d27cf7567.tar.xz
pygobject-d775961664e4755481ef01c192ea8b8d27cf7567.zip
reindent
Diffstat (limited to 'tests')
-rw-r--r--tests/common.py17
-rw-r--r--tests/runtests.py4
-rw-r--r--tests/test_conversion.py14
-rw-r--r--tests/test_enum.py10
-rw-r--r--tests/test_gtype.py12
-rw-r--r--tests/test_mainloop.py4
-rw-r--r--tests/test_properties.py12
-rw-r--r--tests/test_signal.py2
-rw-r--r--tests/test_subtype.py4
-rw-r--r--tests/test_thread.py2
-rw-r--r--tests/test_unknown.py2
-rw-r--r--tests/testmodule.py4
12 files changed, 43 insertions, 44 deletions
diff --git a/tests/common.py b/tests/common.py
index 627e281..3cd6386 100644
--- a/tests/common.py
+++ b/tests/common.py
@@ -4,7 +4,7 @@ import sys
def importModules(buildDir, srcDir):
# Be very careful when you change this code, it's
# fragile and the order is really significant
-
+
# ltihooks
sys.path.insert(0, srcDir)
import ltihooks
@@ -15,15 +15,15 @@ def importModules(buildDir, srcDir):
# testhelper
sys.path.insert(0, os.path.join(buildDir, 'tests'))
sys.argv.append('--g-fatal-warnings')
-
+
gobject = importModule('gobject', buildDir, 'gobject/gobject.la')
testhelper = importModule('testhelper', '.')
-
+
ltihooks.uninstall()
del ltihooks
-
+
globals().update(locals())
-
+
os.environ['PYGTK_USE_GIL_STATE_API'] = ''
gobject.threads_init()
@@ -44,8 +44,8 @@ def importModule(module, directory, name=None):
except ImportError, e:
print 'WARNING: %s could not be imported' % origName
print e
- return
-
+ return
+
if hasattr(obj, '__file__'):
location = obj.__file__
else:
@@ -57,7 +57,6 @@ def importModule(module, directory, name=None):
current = os.path.abspath(location)
if current != expected:
raise AssertionError('module %s imported from wrong location. Expected %s, got %s' % (
- module, expected, current))
+ module, expected, current))
return obj
-
diff --git a/tests/runtests.py b/tests/runtests.py
index da866d4..fc0558d 100644
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -38,8 +38,8 @@ loader = unittest.TestLoader()
for name in gettestnames():
if program and program not in name:
- continue
+ continue
suite.addTest(loader.loadTestsFromName(name))
-
+
testRunner = unittest.TextTestRunner()
testRunner.run(suite)
diff --git a/tests/test_conversion.py b/tests/test_conversion.py
index 373ab9d..d3aee72 100644
--- a/tests/test_conversion.py
+++ b/tests/test_conversion.py
@@ -7,10 +7,10 @@ import unittest
from common import gtk, gobject
class Tests(unittest.TestCase):
-
+
def testUnicharArg(self):
""" Test unichar values when used as arguments. """
-
+
entry = gtk.Entry()
for valid_value in ['a', u'b', u'\ufff0', u'\ufff0'.encode()]:
entry.set_invisible_char(valid_value)
@@ -27,11 +27,11 @@ class Tests(unittest.TestCase):
raise AssertionError(
'exception not raised on invalid value w/ '
'set_invisible_char: %s' % invalid_value)
-
+
def testUnicharProperty(self):
""" Test unichar values when used as properties. """
-
+
entry = gtk.Entry()
for valid_value in ['a', u'b', u'\ufff0', u'\ufff0'.encode()]:
entry.set_property('invisible_char', valid_value)
@@ -53,7 +53,7 @@ class Tests(unittest.TestCase):
entry = gobject.new(gtk.Entry, invisible_char=valid_value)
self.assertEqual(entry.get_property('invisible_char'),
valid_value, valid_value)
-
+
def testColorCreation(self):
""" Test GdkColor creation """
@@ -76,10 +76,10 @@ class Tests(unittest.TestCase):
table = gtk.Table(2, 2, False)
table.attach(child, 1, 2, 0, 1, ypadding=2)
self.assertEqual(table.child_get_property(child, 'y-padding'), 2)
-
+
child = gtk.DrawingArea()
table.attach(child, 1, 2, 0, 1, ypadding=2L)
self.assertEqual(table.child_get_property(child, 'y-padding'), 2)
-
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_enum.py b/tests/test_enum.py
index 508ad16..88d8287 100644
--- a/tests/test_enum.py
+++ b/tests/test_enum.py
@@ -123,7 +123,7 @@ class FlagsTest(unittest.TestCase):
else:
raise AssertionError
warnings.resetwarnings()
-
+
def testFlagOperations(self):
a = gdk.BUTTON_PRESS_MASK
self.failUnless(isinstance(a, GFlags))
@@ -164,7 +164,7 @@ class FlagsTest(unittest.TestCase):
self.assertEquals(int(c), (int(gdk.BUTTON_PRESS_MASK) |
int(gdk.BUTTON_RELEASE_MASK) |
int(gdk.ENTER_NOTIFY_MASK)))
-
+
def testUnsupportedOpertionWarning(self):
warnings.filterwarnings("error", "", Warning, "", 0)
try:
@@ -180,13 +180,13 @@ class FlagsTest(unittest.TestCase):
gtk.container_class_list_child_properties(gtk.Table))
self.failUnless(len(props) >= 2)
pspec = props[0]
- klass = pspec.flags_class
+ klass = pspec.flags_class
self.assertEquals(klass, gtk.AttachOptions)
self.failUnless(hasattr(klass, '__flags_values__'))
self.failUnless(isinstance(klass.__flags_values__, dict))
self.failUnless(len(klass.__flags_values__) >= 3)
self.failUnless(isinstance(pspec.default_value, gtk.AttachOptions))
-
+
def testEnumComparision(self):
enum = gtk.TREE_VIEW_DROP_BEFORE
self.assertEquals(enum, 0)
@@ -201,7 +201,7 @@ class FlagsTest(unittest.TestCase):
self.failUnless(not enum >= 10)
self.failUnless(enum <= 0)
self.failUnless(enum <= 10)
-
+
def testFlagComparision(self):
flag = gdk.EXPOSURE_MASK
self.assertEquals(flag, 2)
diff --git a/tests/test_gtype.py b/tests/test_gtype.py
index b8177fd..52efda4 100644
--- a/tests/test_gtype.py
+++ b/tests/test_gtype.py
@@ -8,16 +8,16 @@ class GTypeTest(unittest.TestCase):
# 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,
+ 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,
+ self.assertEqual(val, expected,
'got %r while %r was expected' %
(val, expected))
-
+
def testBool(self):
self.checkType(gobject.TYPE_BOOLEAN, 'gboolean', bool)
@@ -26,7 +26,7 @@ class GTypeTest(unittest.TestCase):
# model = gtk.ListStore(str, int)
# iter = model.append()
# model.set(iter, 1, 100000000)
-
+
def testInt64(self):
self.checkType(gobject.TYPE_INT64, 'gint64')
@@ -50,7 +50,7 @@ class GTypeTest(unittest.TestCase):
def testPyObject(self):
self.checkType(gobject.TYPE_PYOBJECT, 'GObject', object)
-
+
def testObject(self):
self.checkType(gobject.TYPE_OBJECT, 'PyObject')
@@ -62,6 +62,6 @@ class MyObject(gobject.GObject):
class TypeNameTest(unittest.TestCase):
def testTypeName(self):
self.assertEqual(GType(MyObject).name, 'MyObject')
-
+
if __name__ == '__main__':
unittest.main()
diff --git a/tests/test_mainloop.py b/tests/test_mainloop.py
index 44d6937..8294642 100644
--- a/tests/test_mainloop.py
+++ b/tests/test_mainloop.py
@@ -22,7 +22,7 @@ class TestMainLoop(unittest.TestCase):
def child_died(pid, status, loop):
loop.quit()
raise Exception("deadbabe")
-
+
loop = gobject.MainLoop()
gobject.child_watch_add(pid, child_died, loop)
@@ -40,7 +40,7 @@ class TestMainLoop(unittest.TestCase):
loop.run()
except:
got_exception = True
-
+
#
# The exception should be handled (by printing it)
# immediately on return from child_died() rather
diff --git a/tests/test_properties.py b/tests/test_properties.py
index c73e6a9..d75a810 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -16,14 +16,14 @@ class PropertyObject(GObject):
'uint64': (TYPE_UINT64, 'blurb', 'description', 0, 10, 0,
PARAM_READWRITE),
}
-
+
def __init__(self):
GObject.__init__(self)
self._value = 'default'
self._construct_only = None
self._construct = None
self._uint64 = 0L
-
+
def do_get_property(self, pspec):
if pspec.name == 'normal':
return self._value
@@ -47,7 +47,7 @@ class PropertyObject(GObject):
self._uint64 = value
else:
raise AssertionError
-
+
class TestProperties(unittest.TestCase):
def testGetSet(self):
obj = PropertyObject()
@@ -64,7 +64,7 @@ class TestProperties(unittest.TestCase):
def testSetNoInstance(self):
def set(obj):
obj.props.normal = "foobar"
-
+
self.assertRaises(TypeError, set, PropertyObject)
def testIterator(self):
@@ -85,7 +85,7 @@ class TestProperties(unittest.TestCase):
self.assertEqual(obj.props.normal, "456")
obj.props.normal = '789'
self.assertEqual(obj.props.normal, "789")
-
+
def testConstruct(self):
obj = new(PropertyObject, construct="123")
self.assertEqual(obj.props.construct, "123")
@@ -93,7 +93,7 @@ class TestProperties(unittest.TestCase):
self.assertEqual(obj.props.construct, "456")
obj.props.construct = '789'
self.assertEqual(obj.props.construct, "789")
-
+
def testConstructOnly(self):
obj = new(PropertyObject, construct_only="123")
self.assertEqual(obj.props.construct_only, "123")
diff --git a/tests/test_signal.py b/tests/test_signal.py
index b0c023e..f006fae 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -14,7 +14,7 @@ class C(gobject.GObject):
class D(C):
def do_my_signal(self, arg2):
self.arg2 = arg2
- C.do_my_signal(self, arg2)
+ C.do_my_signal(self, arg2)
class TestChaining(unittest.TestCase):
def setUp(self):
diff --git a/tests/test_subtype.py b/tests/test_subtype.py
index 99fbb3b..178c2f0 100644
--- a/tests/test_subtype.py
+++ b/tests/test_subtype.py
@@ -9,7 +9,7 @@ class TestSubType(unittest.TestCase):
t = type('testtype', (GObject, GInterface), {})
self.failUnless(issubclass(t, GObject))
self.failUnless(issubclass(t, GInterface))
-
+
def testGObject(self):
label = gobject.GObject()
self.assertEqual(label.__grefcount__, 1)
@@ -29,7 +29,7 @@ class TestSubType(unittest.TestCase):
self.assertEqual(obj.__grefcount__, 1)
refcount = testhelper.test_g_object_new()
self.assertEqual(refcount, 2)
-
+
def testRegisterArgNotType(self):
self.assertRaises(TypeError, gobject.type_register, 1)
diff --git a/tests/test_thread.py b/tests/test_thread.py
index 231930f..f1ec01a 100644
--- a/tests/test_thread.py
+++ b/tests/test_thread.py
@@ -9,7 +9,7 @@ class TestThread(unittest.TestCase):
assert test == self.obj
assert int(enum) == 0
assert type(enum) != int
-
+
def idle_cb(self):
self.obj = testhelper.get_test_thread()
self.obj.connect('from-thread', self.from_thread_cb)
diff --git a/tests/test_unknown.py b/tests/test_unknown.py
index 49e8c40..d2ce6de 100644
--- a/tests/test_unknown.py
+++ b/tests/test_unknown.py
@@ -5,7 +5,7 @@ from gobject import GType, new
from common import gobject, testhelper
TestInterface = GType.from_name('TestInterface')
-
+
class TestUnknown(unittest.TestCase):
def testFoo(self):
obj = testhelper.get_unknown()
diff --git a/tests/testmodule.py b/tests/testmodule.py
index 2fda01f..5fc29b3 100644
--- a/tests/testmodule.py
+++ b/tests/testmodule.py
@@ -8,7 +8,7 @@ class PyGObject(gobject.GObject):
'the label of the object',
'default', gobject.PARAM_READWRITE),
}
-
+
def __init__(self):
self._props = {}
gobject.GObject.__init__(self)
@@ -16,6 +16,6 @@ class PyGObject(gobject.GObject):
def do_set_property(self, name, value):
self._props[name] = value
-
+
def do_get_property(self, name):
return self._props[name]