summaryrefslogtreecommitdiff
path: root/tests/test_properties.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_properties.py')
-rw-r--r--tests/test_properties.py24
1 files changed, 14 insertions, 10 deletions
diff --git a/tests/test_properties.py b/tests/test_properties.py
index ccfcb34..19e1136 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -1,4 +1,5 @@
+import sys
import struct
import unittest
@@ -12,6 +13,8 @@ from gobject.constants import \
G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
G_MAXULONG
+from compathelper import _long
+
class PropertyObject(GObject):
normal = gobject.property(type=str)
construct = gobject.property(
@@ -80,12 +83,12 @@ class TestProperties(unittest.TestCase):
def testUint64(self):
obj = new(PropertyObject)
self.assertEqual(obj.props.uint64, 0)
- obj.props.uint64 = 1L
- self.assertEqual(obj.props.uint64, 1L)
+ obj.props.uint64 = _long(1)
+ self.assertEqual(obj.props.uint64, _long(1))
obj.props.uint64 = 1
- self.assertEqual(obj.props.uint64, 1L)
+ self.assertEqual(obj.props.uint64, _long(1))
- self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1L)
+ self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", _long(-1))
self.assertRaises((TypeError, OverflowError), obj.set_property, "uint64", -1)
def testUInt64DefaultValue(self):
@@ -93,10 +96,11 @@ class TestProperties(unittest.TestCase):
class TimeControl(GObject):
__gproperties__ = {
'time': (TYPE_UINT64, 'Time', 'Time',
- 0L, (1<<64) - 1, 0L,
+ _long(0), (1<<64) - 1, _long(0),
PARAM_READABLE)
}
- except OverflowError, ex:
+ except OverflowError:
+ (etype, ex) = sys.exc_info()[2:]
self.fail(str(ex))
def testRange(self):
@@ -182,7 +186,7 @@ class TestProperty(unittest.TestCase):
str = gobject.property(type=str)
int = gobject.property(type=int)
float = gobject.property(type=float)
- long = gobject.property(type=long)
+ long = gobject.property(type=_long)
self.failUnless(hasattr(C.props, 'str'))
self.failUnless(hasattr(C.props, 'int'))
@@ -202,9 +206,9 @@ class TestProperty(unittest.TestCase):
o.float = 3.14
self.assertEqual(o.float, 3.14)
- self.assertEqual(o.long, 0L)
- o.long = 100L
- self.assertEqual(o.long, 100L)
+ self.assertEqual(o.long, _long(0))
+ o.long = _long(100)
+ self.assertEqual(o.long, _long(100))
def testCustomGetter(self):
class C(gobject.GObject):