summaryrefslogtreecommitdiffstats
path: root/tests/test_properties.py
diff options
context:
space:
mode:
authorJohn Ehresman <jpe@wingware.com>2010-04-15 12:55:34 -0400
committerJohn Ehresman <jpe@wingware.com>2010-04-15 12:55:34 -0400
commitdc91f48833e5f3b94f02a0be16d0d47c10d364f5 (patch)
tree2df70dbf32d1e33f51af596d9ff93d327d761cf8 /tests/test_properties.py
parentfb6529e5e6c253d5fcc0038eafc1c1d9e23ca9ae (diff)
downloadpygobject-dc91f48833e5f3b94f02a0be16d0d47c10d364f5.tar.gz
pygobject-dc91f48833e5f3b94f02a0be16d0d47c10d364f5.tar.xz
pygobject-dc91f48833e5f3b94f02a0be16d0d47c10d364f5.zip
Changes for tests to run in python 3
Diffstat (limited to 'tests/test_properties.py')
-rw-r--r--tests/test_properties.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/tests/test_properties.py b/tests/test_properties.py
index ccfcb34..b05234c 100644
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -12,6 +12,11 @@ from gobject.constants import \
G_MININT, G_MAXINT, G_MAXUINT, G_MINLONG, G_MAXLONG, \
G_MAXULONG
+try:
+ _long = long
+except NameError:
+ _long = int
+
class PropertyObject(GObject):
normal = gobject.property(type=str)
construct = gobject.property(
@@ -80,12 +85,18 @@ 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, _long(1))
+
+ 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 +104,12 @@ 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:
+ import sys
+ ex = sys.exc_info()[1]
self.fail(str(ex))
def testRange(self):
@@ -202,9 +215,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):