diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/common.py | 17 | ||||
-rw-r--r-- | tests/runtests.py | 4 | ||||
-rw-r--r-- | tests/test_actiongroup.py | 4 | ||||
-rw-r--r-- | tests/test_conversion.py | 14 | ||||
-rw-r--r-- | tests/test_dialog.py | 4 | ||||
-rw-r--r-- | tests/test_enum.py | 10 | ||||
-rw-r--r-- | tests/test_gdkevent.py | 2 | ||||
-rw-r--r-- | tests/test_liststore.py | 2 | ||||
-rw-r--r-- | tests/test_radiobutton.py | 14 | ||||
-rw-r--r-- | tests/test_style.py | 1 | ||||
-rw-r--r-- | tests/testmodule.py | 1 |
11 files changed, 35 insertions, 38 deletions
diff --git a/tests/common.py b/tests/common.py index d2785e1c..5043c64a 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) # atk, pango @@ -15,7 +15,7 @@ def importModules(buildDir, srcDir): sys.path.insert(0, os.path.join(buildDir, 'gtk')) sys.argv.append('--g-fatal-warnings') import ltihooks - + gobject = importModule('gobject', buildDir, 'gobject/gobject.la') atk = importModule('atk', buildDir) pango = importModule('pango', buildDir) @@ -25,12 +25,12 @@ def importModules(buildDir, srcDir): glade = importModule('gtk.glade', buildDir, 'glade.la') except ImportError: glade = None - + ltihooks.uninstall() del ltihooks - + globals().update(locals()) - + os.environ['PYGTK_USE_GIL_STATE_API'] = '' gobject.threads_init() @@ -50,8 +50,8 @@ def importModule(module, directory, name=None): obj = __import__(module, {}, {}, fromlist) except ImportError: print 'WARNING: %s could not be imported' % origName - return - + return + if hasattr(obj, '__file__'): location = obj.__file__ else: @@ -63,7 +63,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 42f6a0c7..7c5a3086 100644 --- a/tests/runtests.py +++ b/tests/runtests.py @@ -37,8 +37,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_actiongroup.py b/tests/test_actiongroup.py index 77fcb59d..02aa4231 100644 --- a/tests/test_actiongroup.py +++ b/tests/test_actiongroup.py @@ -34,7 +34,7 @@ class ActionGroupTest(unittest.TestCase): </placeholder> </toolbar> </ui>''' - + def build_gui(self): # Create the toplevel window window = gtk.Window() @@ -118,7 +118,7 @@ class ActionGroupTest(unittest.TestCase): gtk.main_quit() def setUp(self): - gc.collect() + gc.collect() def testActionGroups(self): self.build_gui() diff --git a/tests/test_conversion.py b/tests/test_conversion.py index 373ab9d1..d3aee722 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_dialog.py b/tests/test_dialog.py index 1ee4286b..9102af65 100644 --- a/tests/test_dialog.py +++ b/tests/test_dialog.py @@ -8,7 +8,7 @@ from common import gtk class MessageDialogTest(unittest.TestCase): def testDialogAdd(self): dialog = gtk.MessageDialog() - + response_id = sys.maxint + 1 self.assertRaises(OverflowError, dialog.add_button, "Foo", response_id) self.assertRaises(OverflowError, dialog.add_buttons, "Foo", response_id) @@ -30,6 +30,6 @@ class MessageDialogTest(unittest.TestCase): while gc.collect(): pass self.assertEqual(ref(), None) - + if __name__ == '__main__': unittest.main() diff --git a/tests/test_enum.py b/tests/test_enum.py index 508ad16c..88d82872 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_gdkevent.py b/tests/test_gdkevent.py index 9ba0613a..1721a9e4 100644 --- a/tests/test_gdkevent.py +++ b/tests/test_gdkevent.py @@ -12,7 +12,7 @@ class TestGdkEvent(unittest.TestCase): win1.realize() event.window = win1.window self.assertEqual(event.window, win1.window) - + win2 = gtk.Window() win2.realize() event.window = win2.window diff --git a/tests/test_liststore.py b/tests/test_liststore.py index a5d9f616..65cc900c 100644 --- a/tests/test_liststore.py +++ b/tests/test_liststore.py @@ -13,7 +13,7 @@ class ListStoreTest(unittest.TestCase): store.set_value(store.insert(0), 0, 2) self.assertEqual(len(store), 1) self.assertEqual(store[0][0], 2) - + # New way store.insert(0, (1,)) self.assertEqual(len(store), 2) diff --git a/tests/test_radiobutton.py b/tests/test_radiobutton.py index 98d86dd6..43a1c4f6 100644 --- a/tests/test_radiobutton.py +++ b/tests/test_radiobutton.py @@ -5,7 +5,7 @@ from common import gtk class RadioTest(unittest.TestCase): widget_type = None constructor_args = () - + def new(self): return self.widget_type(*self.constructor_args) @@ -17,10 +17,10 @@ class RadioTest(unittest.TestCase): def getLabel(self, obj): return obj.get_property('label') - + def compareGroups(self, group1, group2): return self.assertEqual(group1, group2) - + def testCreate(self): if self.widget_type is None: return @@ -40,7 +40,7 @@ class RadioTest(unittest.TestCase): radio2 = self.newGroup(radio) self.compareGroups(radio.get_group(), radio2.get_group()) self.compareGroups(radio2.get_group(), radio.get_group()) - + def testEmptyGroup(self): if self.widget_type is None: return @@ -57,11 +57,11 @@ class RadioTest(unittest.TestCase): class RadioButtonTest(RadioTest): widget_type = gtk.RadioButton - + class RadioActionTest(RadioTest): widget_type = gtk.RadioAction constructor_args = ('RadioAction', 'test-radio-action', '', '', 0) - + def newGroup(self, radio): # No constructor, so set it manually obj = self.new() @@ -85,7 +85,7 @@ class RadioToolButtonTest(RadioTest): radio = gtk.RadioToolButton(None) radio.set_label(label) return radio - + class RadioMenuItem(RadioTest): widget_type = gtk.RadioMenuItem diff --git a/tests/test_style.py b/tests/test_style.py index 6bc8f9ce..a356a5ae 100644 --- a/tests/test_style.py +++ b/tests/test_style.py @@ -28,4 +28,3 @@ class StylePixmapTest(unittest.TestCase): self.assertRaises(TypeError, func, gtk.STATE_NORMAL, True) self.assertRaises(TypeError, func, gtk.STATE_NORMAL, 0L) self.assertRaises(TypeError, func, gtk.STATE_NORMAL, object()) - diff --git a/tests/testmodule.py b/tests/testmodule.py index 8761ecfc..c6263341 100644 --- a/tests/testmodule.py +++ b/tests/testmodule.py @@ -6,4 +6,3 @@ class PyLabel(gtk.Label): def __init__(self): gtk.Label.__init__(self, "hello") - |