diff options
author | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-04 11:24:57 +0200 |
---|---|---|
committer | Christoph Reiter <reiter.christoph@gmail.com> | 2018-04-04 11:29:29 +0200 |
commit | c20db2d70de4b730d0dd3e62333587d13e6d20a1 (patch) | |
tree | 65e5118150be61248a788c2eacb095a16e466499 | |
parent | 7d8f8e86e9961f5ca3e777f31a40ec257747e51e (diff) | |
download | pygobject-c20db2d70de4b730d0dd3e62333587d13e6d20a1.tar.gz |
pygi_gint_from_py: fix wrong range in error message, add test
-rw-r--r-- | gi/pygi-basictype.c | 2 | ||||
-rw-r--r-- | tests/test_gi.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/gi/pygi-basictype.c b/gi/pygi-basictype.c index 089a7dde..d9e4b821 100644 --- a/gi/pygi-basictype.c +++ b/gi/pygi-basictype.c @@ -503,7 +503,7 @@ pygi_gint_from_py (PyObject *object, gint *result) if (long_value < G_MININT || long_value > G_MAXINT) { PyErr_Format (PyExc_OverflowError, "%ld not in range %d to %d", - long_value, (int)G_MININT8, (int)G_MAXINT8); + long_value, (int)G_MININT, (int)G_MAXINT); return FALSE; } diff --git a/tests/test_gi.py b/tests/test_gi.py index db138e66..bf51874c 100644 --- a/tests/test_gi.py +++ b/tests/test_gi.py @@ -1610,6 +1610,11 @@ 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)): + GIMarshallingTests.gvalue_flat_array([GLib.MAXINT + 1, "42", True]) + def test_gvalue_flat_array_out(self): values = GIMarshallingTests.return_gvalue_flat_array() self.assertEqual(values, [42, '42', True]) |