From 0c5426031c1a5ab306da5e3ddbee4918efa5aeee Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Thu, 17 Sep 2009 14:46:27 +0000 Subject: added some empty, min, and max to RangedSet git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@816221 13f79535-47bb-0310-9956-ffa450edef68 --- python/tests/datatypes.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'python/tests') diff --git a/python/tests/datatypes.py b/python/tests/datatypes.py index b00e5e78f8..00e649d6cf 100644 --- a/python/tests/datatypes.py +++ b/python/tests/datatypes.py @@ -148,6 +148,34 @@ class RangedSetTest(TestCase): assert range.lower == 0 assert range.upper == 8 + def testEmpty(self): + s = RangedSet() + assert s.empty() + s.add(0, -1) + assert s.empty() + s.add(0, 0) + assert not s.empty() + + def testMinMax(self): + s = RangedSet() + assert s.max() is None + assert s.min() is None + s.add(0, 10) + assert s.max() == 10 + assert s.min() == 0 + s.add(0, 5) + assert s.max() == 10 + assert s.min() == 0 + s.add(0, 11) + assert s.max() == 11 + assert s.min() == 0 + s.add(15, 20) + assert s.max() == 20 + assert s.min() == 0 + s.add(-10, -5) + assert s.max() == 20 + assert s.min() == -10 + class RangeTest(TestCase): def testIntersect1(self): -- cgit v1.2.1