[pygobject/pygobject-3-12] PEP8 fixes



commit 086c10133d6d9ac155e3a7fee7dde198aea1343d
Author: Simon Feltman <sfeltman src gnome org>
Date:   Fri May 2 21:36:25 2014 -0700

    PEP8 fixes
    
    Use infix 'not' instead of prefixed.
    Don't use double comments (##).
    Use space between comment and text.
    Un-comment tests that now work.
    Move broken (and won't fix) implicit int64 signal tests into
    a new skipped test function.

 gi/overrides/GIMarshallingTests.py |    4 ++--
 gi/overrides/Gio.py                |    4 ++--
 gi/overrides/Gtk.py                |    6 +++---
 gi/types.py                        |    2 +-
 pygtkcompat/pygtkcompat.py         |    4 ++--
 tests/test_everything.py           |    1 -
 tests/test_gi.py                   |    9 +++------
 tests/test_iochannel.py            |    2 +-
 tests/test_option.py               |    2 +-
 tests/test_signal.py               |   28 +++++++++++++---------------
 10 files changed, 28 insertions(+), 34 deletions(-)
---
diff --git a/gi/overrides/GIMarshallingTests.py b/gi/overrides/GIMarshallingTests.py
index cc967b4..b675adf 100644
--- a/gi/overrides/GIMarshallingTests.py
+++ b/gi/overrides/GIMarshallingTests.py
@@ -53,13 +53,13 @@ class OverridesObject(GIMarshallingTests.OverridesObject):
     def __init__(self, long_):
         GIMarshallingTests.OverridesObject.__init__(self)
         # FIXME: doesn't work yet
-        #self.long_ = long_
+        # self.long_ = long_
 
     @classmethod
     def new(cls, long_):
         self = GIMarshallingTests.OverridesObject.new()
         # FIXME: doesn't work yet
-        #self.long_ = long_
+        # self.long_ = long_
         return self
 
     def method(self):
diff --git a/gi/overrides/Gio.py b/gi/overrides/Gio.py
index 5a5dd2f..e646821 100644
--- a/gi/overrides/Gio.py
+++ b/gi/overrides/Gio.py
@@ -82,14 +82,14 @@ class Settings(Gio.Settings):
 
     def __getitem__(self, key):
         # get_value() aborts the program on an unknown key
-        if not key in self:
+        if key not in self:
             raise KeyError('unknown key: %r' % (key,))
 
         return self.get_value(key).unpack()
 
     def __setitem__(self, key, value):
         # set_value() aborts the program on an unknown key
-        if not key in self:
+        if key not in self:
             raise KeyError('unknown key: %r' % (key,))
 
         # determine type string of this key
diff --git a/gi/overrides/Gtk.py b/gi/overrides/Gtk.py
index ff9aea1..8887da8 100644
--- a/gi/overrides/Gtk.py
+++ b/gi/overrides/Gtk.py
@@ -1119,13 +1119,13 @@ class TreePath(Gtk.TreePath):
         return self.to_string()
 
     def __lt__(self, other):
-        return not other is None and self.compare(other) < 0
+        return other is not None and self.compare(other) < 0
 
     def __le__(self, other):
-        return not other is None and self.compare(other) <= 0
+        return other is not None and self.compare(other) <= 0
 
     def __eq__(self, other):
-        return not other is None and self.compare(other) == 0
+        return other is not None and self.compare(other) == 0
 
     def __ne__(self, other):
         return other is None or self.compare(other) != 0
diff --git a/gi/types.py b/gi/types.py
index e6e3903..6007e53 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -182,7 +182,7 @@ class _GObjectMetaBase(type):
         cls._type_register(cls.__dict__)
 
     def _type_register(cls, namespace):
-        ## don't register the class if already registered
+        # don't register the class if already registered
         if '__gtype__' in namespace:
             return
 
diff --git a/pygtkcompat/pygtkcompat.py b/pygtkcompat/pygtkcompat.py
index f62a551..7ee2de4 100644
--- a/pygtkcompat/pygtkcompat.py
+++ b/pygtkcompat/pygtkcompat.py
@@ -359,10 +359,10 @@ def enable_gtk(version='3.0'):
     except AttributeError:
         pass
 
-    #AccelGroup
+    # AccelGroup
     Gtk.AccelGroup.connect_group = Gtk.AccelGroup.connect
 
-    #StatusIcon
+    # StatusIcon
     Gtk.status_icon_position_menu = Gtk.StatusIcon.position_menu
     Gtk.StatusIcon.set_tooltip = Gtk.StatusIcon.set_tooltip_text
 
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 0cd1804..cc79dc3 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -15,7 +15,6 @@ try:
 except ImportError:
     has_cairo = False
 
-#import gi
 from gi.repository import GObject
 from gi.repository import GLib
 from gi.repository import Gio
diff --git a/tests/test_gi.py b/tests/test_gi.py
index e790708..a008ce7 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -61,9 +61,8 @@ class Sequence(object):
 
 class TestConstant(unittest.TestCase):
 
-# Blocked by https://bugzilla.gnome.org/show_bug.cgi?id=595773
-#    def test_constant_utf8(self):
-#        self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8)
+    def test_constant_utf8(self):
+        self.assertEqual(CONSTANT_UTF8, GIMarshallingTests.CONSTANT_UTF8)
 
     def test_constant_number(self):
         self.assertEqual(CONSTANT_NUMBER, GIMarshallingTests.CONSTANT_NUMBER)
@@ -2520,9 +2519,7 @@ class TestOverrides(unittest.TestCase):
 
         # not overridden
         self.assertEqual(GIMarshallingTests.SubObject.__module__, 'gi.repository.GIMarshallingTests')
-        # FIXME: does not work with TEST_NAMES='test_thread test_gi.TestOverrides',
-        # it is importlib._bootstrap then
-        #self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject')
+        self.assertEqual(GObject.InitiallyUnowned.__module__, 'gi.repository.GObject')
 
 
 class TestDir(unittest.TestCase):
diff --git a/tests/test_iochannel.py b/tests/test_iochannel.py
index 0cc1b4b..259171b 100644
--- a/tests/test_iochannel.py
+++ b/tests/test_iochannel.py
@@ -108,7 +108,7 @@ second line
 
         ch.seek(2, 2)  # SEEK_END
         # FIXME: does not work currently
-        #self.assertEqual(ch.read(2), b'n!')
+        # self.assertEqual(ch.read(2), b'n!')
 
         # invalid whence value
         self.assertRaises(ValueError, ch.seek, 0, 3)
diff --git a/tests/test_option.py b/tests/test_option.py
index 2900edd..fe25746 100644
--- a/tests/test_option.py
+++ b/tests/test_option.py
@@ -71,7 +71,7 @@ class TestOption(unittest.TestCase):
     def test_parse_args_double_dash(self):
         options, args = self.parser.parse_args(
             ["test_option.py", "--", "-xxx"])
-        #self.assertEqual(args, ["-xxx"])
+        # self.assertEqual(args, ["-xxx"])
 
     def test_parse_args_group(self):
         group = self._create_group()
diff --git a/tests/test_signal.py b/tests/test_signal.py
index 429afc9..80d4ac5 100644
--- a/tests/test_signal.py
+++ b/tests/test_signal.py
@@ -136,9 +136,9 @@ class TestAccumulator(unittest.TestCase):
         inst = Foo()
         inst.my_acc_signal.connect(lambda obj: 1)
         inst.my_acc_signal.connect(lambda obj: 2)
-        ## the value returned in the following handler will not be
-        ## considered, because at this point the accumulator already
-        ## reached its limit.
+        # the value returned in the following handler will not be
+        # considered, because at this point the accumulator already
+        # reached its limit.
         inst.my_acc_signal.connect(lambda obj: 3)
         retval = inst.my_acc_signal.emit()
         self.assertEqual(retval, 3)
@@ -147,8 +147,8 @@ class TestAccumulator(unittest.TestCase):
         inst = Foo()
         inst.my_other_acc_signal.connect(self._true_handler1)
         inst.my_other_acc_signal.connect(self._true_handler2)
-        ## the following handler will not be called because handler2
-        ## returns True, so it should stop the emission.
+        # the following handler will not be called because handler2
+        # returns True, so it should stop the emission.
         inst.my_other_acc_signal.connect(self._true_handler3)
         self.__true_val = None
         inst.my_other_acc_signal.emit()
@@ -629,20 +629,20 @@ class _TestCMarshaller:
         rv = self.obj.emit("test-gvalue", v)
         self.assertEqual(rv, GObject.G_MAXINT64)
 
-        # implicit int64
-        # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775
-        #rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64)
-        #self.assertEqual(rv, GObject.G_MAXINT64)
-
         # explicit uint64
         v = GObject.Value(GObject.TYPE_UINT64, GObject.G_MAXUINT64)
         rv = self.obj.emit("test-gvalue", v)
         self.assertEqual(rv, GObject.G_MAXUINT64)
 
+    @unittest.expectedFailure  # https://bugzilla.gnome.org/show_bug.cgi?id=705291
+    def test_gvalue_implicit_int64(self):
+        # implicit int64
+        rv = self.obj.emit("test-gvalue", GObject.G_MAXINT64)
+        self.assertEqual(rv, GObject.G_MAXINT64)
+
         # implicit uint64
-        # does not work, see https://bugzilla.gnome.org/show_bug.cgi?id=683775
-        #rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64)
-        #self.assertEqual(rv, GObject.G_MAXUINT64)
+        rv = self.obj.emit("test-gvalue", GObject.G_MAXUINT64)
+        self.assertEqual(rv, GObject.G_MAXUINT64)
 
     def test_gvalue_ret(self):
         self.assertEqual(self.obj.emit("test-gvalue-ret", GObject.TYPE_INT),
@@ -705,7 +705,6 @@ class TestSignalDecorator(unittest.TestCase):
         @GObject.SignalOverride
         def notify(self, *args, **kargs):
             self.overridden_closure_called = True
-            #GObject.GObject.notify(self, *args, **kargs)
 
         def on_notify(self, obj, prop):
             self.notify_called = True
@@ -763,7 +762,6 @@ class TestSignalDecorator(unittest.TestCase):
         obj = self.DecoratedOverride()
         obj.connect("notify", obj.on_notify)
         self.assertEqual(obj.value, 0)
-        #obj.notify.emit()
         obj.value = 1
         self.assertEqual(obj.value, 1)
         self.assertTrue(obj.overridden_closure_called)


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