Commit 16fbb17a authored by Martin Pitt's avatar Martin Pitt
Browse files

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
parent fd7f8eef
......@@ -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()
......@@ -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)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment