pygobject3/pygobject-3.7.3-test-gbytes-compare.patch
2012-12-28 22:43:08 +01:00

35 lines
1.2 KiB
Diff

From 05711e815f5dbb840f10c9f42defb748116617c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz>
Date: Fri, 28 Dec 2012 22:12:32 +0100
Subject: [PATCH] test for GBytes.compare must match definition
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.
---
tests/test_gi.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/test_gi.py b/tests/test_gi.py
index bb90b8a..8cb3496 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1053,9 +1053,9 @@ class TestGBytes(unittest.TestCase):
self.assertFalse(a1.equal(b))
self.assertFalse(b.equal(a2))
- self.assertEqual(0, a1.compare(a2))
- self.assertEqual(1, a1.compare(b))
- self.assertEqual(-1, b.compare(a1))
+ self.assertTrue(a1.compare(a2) == 0)
+ self.assertTrue(a1.compare(b) > 0)
+ self.assertTrue(b.compare(a1) < 0)
class TestGByteArray(unittest.TestCase):
--
1.7.7.6