[pygobject] Fix tests for Python 3
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix tests for Python 3
- Date: Thu, 3 May 2012 10:26:44 +0000 (UTC)
commit 16fbb17a9fd17eeb9f886af99e89a214d328dae1
Author: Martin Pitt <martinpitt gnome org>
Date: Thu May 3 12:25:04 2012 +0200
Fix tests for Python 3
cmp() does not exist any more in Python 3, replace with comparison operators.
GIMarshallingTests.array_in_nonzero_nonlen() expects a guint8 array, so we
can't pass a str (which is an Unicode object in Python 3). Pass a byte array
instead.
tests/test_gi.py | 2 +-
tests/test_overrides.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index 6245b4a..1c42261 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -745,7 +745,7 @@ class TestArray(unittest.TestCase):
[1, 2, 3])
def test_array_in_nonzero_nonlen(self):
- GIMarshallingTests.array_in_nonzero_nonlen(1, 'abcd')
+ GIMarshallingTests.array_in_nonzero_nonlen(1, b'abcd')
def test_array_fixed_out_struct(self):
struct1, struct2 = GIMarshallingTests.array_fixed_out_struct()
diff --git a/tests/test_overrides.py b/tests/test_overrides.py
index 4f1e5c9..4e3f7d2 100644
--- a/tests/test_overrides.py
+++ b/tests/test_overrides.py
@@ -1251,7 +1251,7 @@ class TestGtk(unittest.TestCase):
return -1
if v2.startswith('m') and not v1.startswith('m'):
return 1
- return cmp(v1, v2)
+ return (v1 > v2) - (v1 < v2)
list_store = Gtk.ListStore(int, str)
list_store.set_sort_func(2, comp1, None)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]