[pygobject] overflow tests: fix error message match in case the value is larger than long



commit f42afa4f0d7045868008db95a79b0661d06b479f
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Wed Apr 4 11:49:40 2018 +0200

    overflow tests: fix error message match in case the value is larger than long
    
    It will fail early in PYGLIB_PyLong_AsLong() and give us a different error message.
    It would be nice if the error would be independent of the long size, but that's
    for another time.

 tests/test_gi.py             | 7 ++++---
 tests/test_overrides_glib.py | 3 ++-
 2 files changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/tests/test_gi.py b/tests/test_gi.py
index bf51874c..93eea9fe 100644
--- a/tests/test_gi.py
+++ b/tests/test_gi.py
@@ -1610,9 +1610,10 @@ class TestGValue(unittest.TestCase):
         self.assertRaises(OverflowError, GIMarshallingTests.gvalue_flat_array,
                           [GLib.MININT - 1, "42", True])
 
-        with pytest.raises(OverflowError,
-                           match=r'.*not in range %d to %d.*' % (
-                               GLib.MININT, GLib.MAXINT)):
+        with pytest.raises(
+                OverflowError,
+                match=r'.*(not in range %d to %d|too large to convert).*' % (
+                    GLib.MININT, GLib.MAXINT)):
             GIMarshallingTests.gvalue_flat_array([GLib.MAXINT + 1, "42", True])
 
     def test_gvalue_flat_array_out(self):
diff --git a/tests/test_overrides_glib.py b/tests/test_overrides_glib.py
index 8df4b41a..d0a2d64c 100644
--- a/tests/test_overrides_glib.py
+++ b/tests/test_overrides_glib.py
@@ -576,7 +576,8 @@ class TestGVariant(unittest.TestCase):
                                 gerror, source_str)
 
         gerror = GLib.Error(code=GLib.MAXUINT)
-        self.assertRaisesRegexp(OverflowError, ".*not in range.*",
+        self.assertRaisesRegexp(OverflowError,
+                                ".*(not in range|too large to convert).*",
                                 GLib.Variant.parse_error_print_context,
                                 gerror, source_str)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]