summaryrefslogtreecommitdiff
path: root/python/tests
diff options
context:
space:
mode:
authorRafael H. Schloming <rhs@apache.org>2008-05-23 20:22:13 +0000
committerRafael H. Schloming <rhs@apache.org>2008-05-23 20:22:13 +0000
commitf09f774813043aa1abc696c4fc21a49928334978 (patch)
tree24a9de794070640492dc3aa5f1a418c035c23bf6 /python/tests
parent51db72d6d1fdbaebfc2f91fec611cf26d35ea8f5 (diff)
downloadqpid-python-f09f774813043aa1abc696c4fc21a49928334978.tar.gz
QPID-947: Switched over to using proper RFC 1982 serial numbers.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@659647 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/datatypes.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/python/tests/datatypes.py b/python/tests/datatypes.py
index 6d8703ed4f..ef98e81da0 100644
--- a/python/tests/datatypes.py
+++ b/python/tests/datatypes.py
@@ -22,6 +22,39 @@ from qpid.testlib import testrunner
from qpid.spec010 import load
from qpid.datatypes import *
+class SerialTest(TestCase):
+
+ def test(self):
+ for s in (serial(0), serial(0x8FFFFFFF), serial(0xFFFFFFFF)):
+ assert s + 1 > s
+ assert s - 1 < s
+ assert s < s + 1
+ assert s > s - 1
+
+ assert serial(0xFFFFFFFF) + 1 == serial(0)
+
+ assert min(serial(0xFFFFFFFF), serial(0x0)) == serial(0xFFFFFFFF)
+ assert max(serial(0xFFFFFFFF), serial(0x0)) == serial(0x0)
+
+ def testIncr(self):
+ s = serial(0)
+ s += 1
+ assert s == serial(1)
+
+ def testIn(self):
+ l = [serial(1), serial(2), serial(3), serial(4)]
+ assert serial(1) in l
+ assert serial(0xFFFFFFFF + 2) in l
+ assert 4 in l
+
+ def testNone(self):
+ assert serial(0) != None
+
+ def testHash(self):
+ d = {}
+ d[serial(0)] = "zero"
+ assert d[0] == "zero"
+
class RangedSetTest(TestCase):
def check(self, ranges):