[pygobject] Fix test for GBytes.compare()
- From: Martin Pitt <martinpitt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygobject] Fix test for GBytes.compare()
- Date: Sun, 30 Dec 2012 10:35:04 +0000 (UTC)
commit 692c80e11a05e2fb0515580acb22fd6fe65cede1
Author: Dan HorÃk <dan danny cz>
Date: Fri Dec 28 22:12:32 2012 +0100
Fix test for GBytes.compare()
The result of the compare method is defined as equal, less than or greater than zero
and the test must match to that. The underlaying memcmp() function can return other
values than -1, 0 and 1. For example on architectures where it is implemented directly
via a CPU instruction like on s390(x) where I can see -2 as a result instead of the
"expected" -1.
https://bugzilla.gnome.org/show_bug.cgi?id=690837
tests/test_gi.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index bb90b8a..0e161d7 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1054,8 +1054,8 @@ class TestGBytes(unittest.TestCase):
self.assertFalse(b.equal(a2))
self.assertEqual(0, a1.compare(a2))
- self.assertEqual(1, a1.compare(b))
- self.assertEqual(-1, b.compare(a1))
+ self.assertLess(0, a1.compare(b))
+ self.assertGreater(0, b.compare(a1))
class TestGByteArray(unittest.TestCase):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]