summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Pölsterl <sebp@k-d-w.org>2012-05-10 20:47:52 +0200
committerSebastian Pölsterl <sebp@k-d-w.org>2012-05-10 20:47:52 +0200
commita890cf021a414a16361f0d1a9ecf6c86b10507ff (patch)
tree4ed8408705881e9efd31413da9f89aac405016e1
parent0ed74e4c4da4ed3313d83807b998f4f096aeefcd (diff)
downloadpygobject-a890cf021a414a16361f0d1a9ecf6c86b10507ff.tar.gz
Reindent files in tests to use 4-space indentation
Previously, running make check with python3 resulted in a TabError because tabs and spaces for indentation where mixed
-rw-r--r--tests/compathelper.py2
-rwxr-xr-xtests/runtests.py17
-rw-r--r--tests/test_everything.py24
-rw-r--r--tests/test_gdbus.py11
-rw-r--r--tests/test_gi.py38
-rw-r--r--tests/test_gobject.py2
-rw-r--r--tests/test_interface.py1
-rw-r--r--tests/test_option.py1
-rw-r--r--tests/test_overrides.py80
-rw-r--r--tests/test_properties.py2
-rw-r--r--tests/test_source.py2
-rw-r--r--tests/test_uris.py1
12 files changed, 88 insertions, 93 deletions
diff --git a/tests/compathelper.py b/tests/compathelper.py
index 24657470..668e60a5 100644
--- a/tests/compathelper.py
+++ b/tests/compathelper.py
@@ -49,7 +49,7 @@ if sys.version_info >= (3, 0):
for tests that need to write to intefaces that take unicode in
python 2
- python 3 strings are unicode encoded as UTF-8 so the unicode object
+ python 3 strings are unicode encoded as UTF-8 so the unicode object
doesn't exist
python 2 differs between a string an unicode string and you must specify
diff --git a/tests/runtests.py b/tests/runtests.py
index 65be7a6d..2ca1b023 100755
--- a/tests/runtests.py
+++ b/tests/runtests.py
@@ -18,19 +18,19 @@ os.environ['LC_MESSAGES'] = 'C'
# Load tests.
if 'TEST_NAMES' in os.environ:
- names = os.environ['TEST_NAMES'].split()
+ names = os.environ['TEST_NAMES'].split()
elif 'TEST_FILES' in os.environ:
- names = []
- for filename in os.environ['TEST_FILES'].split():
- names.append(filename[:-3])
+ names = []
+ for filename in os.environ['TEST_FILES'].split():
+ names.append(filename[:-3])
elif len(sys.argv) > 1:
names = []
for filename in sys.argv[1:]:
names.append(filename.replace('.py', ''))
else:
- names = []
- for filename in glob.iglob(os.path.join(mydir, 'test_*.py')):
- names.append(os.path.basename(filename)[:-3])
+ names = []
+ for filename in glob.iglob(os.path.join(mydir, 'test_*.py')):
+ names.append(os.path.basename(filename)[:-3])
loader = unittest.TestLoader()
suite = loader.loadTestsFromNames(names)
@@ -40,5 +40,4 @@ suite = loader.loadTestsFromNames(names)
runner = unittest.TextTestRunner(verbosity=2)
result = runner.run(suite)
if not result.wasSuccessful():
- sys.exit(1) # exit code so "make check" reports error
-
+ sys.exit(1) # exit code so "make check" reports error
diff --git a/tests/test_everything.py b/tests/test_everything.py
index 86ddb420..ffebf949 100644
--- a/tests/test_everything.py
+++ b/tests/test_everything.py
@@ -66,7 +66,7 @@ class TestEverything(unittest.TestCase):
self.assertEquals(UNICHAR, Everything.test_unichar(UNICHAR))
self.assertRaises(TypeError, Everything.test_unichar, "")
self.assertRaises(TypeError, Everything.test_unichar, "morethanonechar")
-
+
def test_floating(self):
e = Everything.TestFloating()
@@ -140,22 +140,22 @@ class TestEverything(unittest.TestCase):
gtype = Everything.test_gtype(ARegisteredClass)
self.assertEquals(ARegisteredClass.__gtype__, gtype)
self.assertRaises(TypeError, Everything.test_gtype, 'ARegisteredClass')
-
+
def test_dir(self):
attr_list = dir(Everything)
-
+
# test that typelib attributes are listed
self.assertTrue('TestStructA' in attr_list)
-
+
# test that class attributes and methods are listed
self.assertTrue('__class__' in attr_list)
self.assertTrue('__dir__' in attr_list)
self.assertTrue('__repr__' in attr_list)
-
+
# test that instance members are listed
self.assertTrue('_namespace' in attr_list)
self.assertTrue('_version' in attr_list)
-
+
# test that there are no duplicates returned
self.assertEqual(len(attr_list), len(set(attr_list)))
@@ -235,7 +235,7 @@ class TestCallbacks(unittest.TestCase):
TestCallbacks.called = False
def callback():
TestCallbacks.called = True
-
+
Everything.test_simple_callback(callback)
self.assertTrue(TestCallbacks.called)
@@ -246,7 +246,7 @@ class TestCallbacks(unittest.TestCase):
"""
def callback():
x = 1 / 0
-
+
try:
Everything.test_simple_callback(callback)
except ZeroDivisionError:
@@ -278,7 +278,7 @@ class TestCallbacks(unittest.TestCase):
self.assertEquals(Everything.test_callback(callback), 44)
self.assertTrue(TestCallbacks.called)
-
+
def test_callback_async(self):
TestCallbacks.called = False
def callback(foo):
@@ -305,11 +305,11 @@ class TestCallbacks(unittest.TestCase):
self.assertEquals(userdata, "Test%d" % TestCallbacks.called)
TestCallbacks.called += 1
return TestCallbacks.called
-
+
for i in range(100):
val = Everything.test_callback_user_data(callback, "Test%d" % i)
self.assertEquals(val, i+1)
-
+
self.assertEquals(TestCallbacks.called, 100)
def test_callback_userdata_refcount(self):
@@ -323,7 +323,7 @@ class TestCallbacks(unittest.TestCase):
start_ref_count = getrefcount(ud)
for i in range(100):
Everything.test_callback_destroy_notify(callback, ud)
-
+
Everything.test_callback_thaw_notifications()
end_ref_count = getrefcount(ud)
diff --git a/tests/test_gdbus.py b/tests/test_gdbus.py
index 2ccf08a4..7af88472 100644
--- a/tests/test_gdbus.py
+++ b/tests/test_gdbus.py
@@ -15,20 +15,20 @@ class TestGDBusClient(unittest.TestCase):
self.bus = Gio.bus_get_sync(Gio.BusType.SESSION, None)
self.dbus_proxy = Gio.DBusProxy.new_sync(self.bus,
- Gio.DBusProxyFlags.NONE, None,
+ Gio.DBusProxyFlags.NONE, None,
'org.freedesktop.DBus',
'/org/freedesktop/DBus',
'org.freedesktop.DBus', None)
def test_native_calls_sync(self):
- result = self.dbus_proxy.call_sync('ListNames', None,
+ result = self.dbus_proxy.call_sync('ListNames', None,
Gio.DBusCallFlags.NO_AUTO_START, 500, None)
self.assertTrue(isinstance(result, GLib.Variant))
result = result.unpack()[0] # result is always a tuple
self.assertTrue(len(result) > 1)
self.assertTrue('org.freedesktop.DBus' in result)
- result = self.dbus_proxy.call_sync('GetNameOwner',
+ result = self.dbus_proxy.call_sync('GetNameOwner',
GLib.Variant('(s)', ('org.freedesktop.DBus',)),
Gio.DBusCallFlags.NO_AUTO_START, 500, None)
self.assertTrue(isinstance(result, GLib.Variant))
@@ -45,7 +45,7 @@ class TestGDBusClient(unittest.TestCase):
# error case: invalid argument
try:
- self.dbus_proxy.call_sync('GetConnectionUnixProcessID',
+ self.dbus_proxy.call_sync('GetConnectionUnixProcessID',
GLib.Variant('(s)', (' unknown',)),
Gio.DBusCallFlags.NO_AUTO_START, 500, None)
self.fail('call with invalid arguments should raise an exception')
@@ -69,7 +69,7 @@ class TestGDBusClient(unittest.TestCase):
main_loop = GObject.MainLoop()
data = {'main_loop': main_loop}
- self.dbus_proxy.call('ListNames', None,
+ self.dbus_proxy.call('ListNames', None,
Gio.DBusCallFlags.NO_AUTO_START, 500, None,
call_done, data)
main_loop.run()
@@ -204,4 +204,3 @@ class TestGDBusClient(unittest.TestCase):
self.assertTrue(isinstance(data['error'], Exception))
self.assertTrue('InvalidArgs' in str(data['error']), str(data['error']))
-
diff --git a/tests/test_gi.py b/tests/test_gi.py
index edbe4619..26b5ce99 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -716,33 +716,33 @@ class TestArray(unittest.TestCase):
self.assertEquals([-1, 0, 1, 2], object_.method_array_return())
def test_array_enum_in(self):
- GIMarshallingTests.array_enum_in([GIMarshallingTests.Enum.VALUE1,
- GIMarshallingTests.Enum.VALUE2,
- GIMarshallingTests.Enum.VALUE3])
+ GIMarshallingTests.array_enum_in([GIMarshallingTests.Enum.VALUE1,
+ GIMarshallingTests.Enum.VALUE2,
+ GIMarshallingTests.Enum.VALUE3])
def test_array_boxed_struct_in(self):
- struct1 = GIMarshallingTests.BoxedStruct()
- struct1.long_ = 1
- struct2 = GIMarshallingTests.BoxedStruct()
- struct2.long_ = 2
- struct3 = GIMarshallingTests.BoxedStruct()
- struct3.long_ = 3
+ struct1 = GIMarshallingTests.BoxedStruct()
+ struct1.long_ = 1
+ struct2 = GIMarshallingTests.BoxedStruct()
+ struct2.long_ = 2
+ struct3 = GIMarshallingTests.BoxedStruct()
+ struct3.long_ = 3
- GIMarshallingTests.array_struct_in([struct1, struct2, struct3])
+ GIMarshallingTests.array_struct_in([struct1, struct2, struct3])
def test_array_simple_struct_in(self):
- struct1 = GIMarshallingTests.SimpleStruct()
- struct1.long_ = 1
- struct2 = GIMarshallingTests.SimpleStruct()
- struct2.long_ = 2
- struct3 = GIMarshallingTests.SimpleStruct()
- struct3.long_ = 3
+ struct1 = GIMarshallingTests.SimpleStruct()
+ struct1.long_ = 1
+ struct2 = GIMarshallingTests.SimpleStruct()
+ struct2.long_ = 2
+ struct3 = GIMarshallingTests.SimpleStruct()
+ struct3.long_ = 3
- GIMarshallingTests.array_simple_struct_in([struct1, struct2, struct3])
+ GIMarshallingTests.array_simple_struct_in([struct1, struct2, struct3])
def test_array_multi_array_key_value_in(self):
- GIMarshallingTests.multi_array_key_value_in(["one", "two", "three"],
- [1, 2, 3])
+ GIMarshallingTests.multi_array_key_value_in(["one", "two", "three"],
+ [1, 2, 3])
def test_array_fixed_out_struct(self):
struct1, struct2 = GIMarshallingTests.array_fixed_out_struct()
diff --git a/tests/test_gobject.py b/tests/test_gobject.py
index eef9cf6f..4bb7c53f 100644
--- a/tests/test_gobject.py
+++ b/tests/test_gobject.py
@@ -123,7 +123,7 @@ class TestReferenceCounting(unittest.TestCase):
obj.release()
self.assertEquals(obj.__grefcount__, 1)
-
+
def testFloatingAndSunkUsingGObjectNew(self):
# Upon creation, the refcount of the object should be 2:
# - someone already has a reference on the new object.
diff --git a/tests/test_interface.py b/tests/test_interface.py
index f60a25c5..2df61b10 100644
--- a/tests/test_interface.py
+++ b/tests/test_interface.py
@@ -46,4 +46,3 @@ class TestIfaceImpl(unittest.TestCase):
m = MyObject()
m.iface_method()
self.assertEqual(m.called, True)
-
diff --git a/tests/test_option.py b/tests/test_option.py
index 9233eed9..6718eb36 100644
--- a/tests/test_option.py
+++ b/tests/test_option.py
@@ -118,4 +118,3 @@ class TestOption(unittest.TestCase):
assert (sio.getvalue().split('\n')[-2] ==
"Exception: " + self.EXCEPTION_MESSAGE)
-
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 92c615cf..becb4cbe 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -11,7 +11,7 @@ from compathelper import _long, _unicode, _bytes
os.environ['GSETTINGS_BACKEND'] = 'memory'
# support a separate build tree, so look in build dir first
-os.environ['GSETTINGS_SCHEMA_DIR'] = os.environ.get('TESTS_BUILDDIR',
+os.environ['GSETTINGS_SCHEMA_DIR'] = os.environ.get('TESTS_BUILDDIR',
os.path.dirname(__file__))
from gi.repository import GLib
@@ -346,15 +346,15 @@ class TestGLib(unittest.TestCase):
self.assertEqual(GLib.Variant.split_signature('(iso)'), ['i', 's', 'o'])
- self.assertEqual(GLib.Variant.split_signature('(s(ss)i(ii))'),
+ self.assertEqual(GLib.Variant.split_signature('(s(ss)i(ii))'),
['s', '(ss)', 'i', '(ii)'])
self.assertEqual(GLib.Variant.split_signature('(as)'), ['as'])
- self.assertEqual(GLib.Variant.split_signature('(s(ss)iaiaasa(ii))'),
+ self.assertEqual(GLib.Variant.split_signature('(s(ss)iaiaasa(ii))'),
['s', '(ss)', 'i', 'ai', 'aas', 'a(ii)'])
- self.assertEqual(GLib.Variant.split_signature('(a{iv}(ii)((ss)a{s(ss)}))'),
+ self.assertEqual(GLib.Variant.split_signature('(a{iv}(ii)((ss)a{s(ss)}))'),
['a{iv}', '(ii)', '((ss)a{s(ss)})'])
def test_variant_hash(self):
@@ -975,41 +975,41 @@ class TestGtk(unittest.TestCase):
treeiter = tree_store.iter_children(parent)
while treeiter:
- i = tree_store.get_value(treeiter, 0)
- s = tree_store.get_value(treeiter, 1)
- obj = tree_store.get_value(treeiter, 2)
- obj.check(i, s)
- obj2 = tree_store.get_value(treeiter, 3)
- self.assertEquals(obj, obj2);
-
- pyobj = tree_store.get_value(treeiter, 4)
- self.assertEquals(pyobj, test_pyobj)
- pydict = tree_store.get_value(treeiter, 5)
- self.assertEquals(pydict, test_pydict)
- pylist = tree_store.get_value(treeiter, 6)
- self.assertEquals(pylist, test_pylist)
-
- bool_1 = tree_store.get_value(treeiter, 7)
- bool_2 = tree_store.get_value(treeiter, 8)
- self.assertEquals(bool_1, bool_2)
- self.assertTrue(isinstance(bool_1, bool))
- self.assertTrue(isinstance(bool_2, bool))
-
- uint_ = tree_store.get_value(treeiter, 9)
- self.assertEquals(uint_, i)
- ulong_ = tree_store.get_value(treeiter, 10)
- self.assertEquals(ulong_, GObject.G_MAXULONG)
- int64_ = tree_store.get_value(treeiter, 11)
- self.assertEquals(int64_, GObject.G_MININT64)
- uint64_ = tree_store.get_value(treeiter, 12)
- self.assertEquals(uint64_, 0xffffffffffffffff)
- uchar_ = tree_store.get_value(treeiter, 13)
- self.assertEquals(ord(uchar_), 254)
- char_ = tree_store.get_value(treeiter, 14)
- self.assertEquals(char_, 'a')
-
- parent = treeiter
- treeiter = tree_store.iter_children(parent)
+ i = tree_store.get_value(treeiter, 0)
+ s = tree_store.get_value(treeiter, 1)
+ obj = tree_store.get_value(treeiter, 2)
+ obj.check(i, s)
+ obj2 = tree_store.get_value(treeiter, 3)
+ self.assertEquals(obj, obj2);
+
+ pyobj = tree_store.get_value(treeiter, 4)
+ self.assertEquals(pyobj, test_pyobj)
+ pydict = tree_store.get_value(treeiter, 5)
+ self.assertEquals(pydict, test_pydict)
+ pylist = tree_store.get_value(treeiter, 6)
+ self.assertEquals(pylist, test_pylist)
+
+ bool_1 = tree_store.get_value(treeiter, 7)
+ bool_2 = tree_store.get_value(treeiter, 8)
+ self.assertEquals(bool_1, bool_2)
+ self.assertTrue(isinstance(bool_1, bool))
+ self.assertTrue(isinstance(bool_2, bool))
+
+ uint_ = tree_store.get_value(treeiter, 9)
+ self.assertEquals(uint_, i)
+ ulong_ = tree_store.get_value(treeiter, 10)
+ self.assertEquals(ulong_, GObject.G_MAXULONG)
+ int64_ = tree_store.get_value(treeiter, 11)
+ self.assertEquals(int64_, GObject.G_MININT64)
+ uint64_ = tree_store.get_value(treeiter, 12)
+ self.assertEquals(uint64_, 0xffffffffffffffff)
+ uchar_ = tree_store.get_value(treeiter, 13)
+ self.assertEquals(ord(uchar_), 254)
+ char_ = tree_store.get_value(treeiter, 14)
+ self.assertEquals(char_, 'a')
+
+ parent = treeiter
+ treeiter = tree_store.iter_children(parent)
self.assertEquals(i, 99)
@@ -1124,7 +1124,7 @@ class TestGtk(unittest.TestCase):
list_store.set_value(treeiter, 2, TestGtk.TestClass(self, i, label))
list_store.set_value(treeiter, 4, test_pydict)
list_store.set_value(treeiter, 7, True)
-
+
# this should append
i = 99
label = 'this is row #99'
diff --git a/tests/test_properties.py b/tests/test_properties.py
index f7f8e253..b1ae0eaf 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -90,7 +90,7 @@ class TestProperties(unittest.TestCase):
self.assertEqual(obj.props.construct, "456")
obj.props.construct = '789'
self.assertEqual(obj.props.construct, "789")
-
+
def testUTF8(self):
obj = new(PropertyObject, construct_only=UNICODE_UTF8)
self.assertEqual(obj.props.construct_only, TEST_UTF8)
diff --git a/tests/test_source.py b/tests/test_source.py
index ad052cca..7530318b 100644
--- a/tests/test_source.py
+++ b/tests/test_source.py
@@ -90,7 +90,7 @@ class TestSource(unittest.TestCase):
class TestTimeout(unittest.TestCase):
- def test504337(self):
+ def test504337(self):
timeout_source = GLib.Timeout(20)
idle_source = GLib.Idle()
diff --git a/tests/test_uris.py b/tests/test_uris.py
index 81743248..c223d3ea 100644
--- a/tests/test_uris.py
+++ b/tests/test_uris.py
@@ -12,4 +12,3 @@ class TestUris(unittest.TestCase):
assert uri_list[0] == "http://www.huh.org/books/foo.html"
assert uri_list[1] == "http://www.huh.org/books/foo.pdf"
assert uri_list[2] == "ftp://ftp.foo.org/books/foo.txt"
-