From 6fa568daae3291c7a876cd903f04079a12945dcb Mon Sep 17 00:00:00 2001 From: mike Date: Tue, 05 May 2009 05:44:27 +0000 Subject: Merge branch 'mike' Conflicts: source/external/source/sugar-toolkit/src/sugar/tutorius/actions.py source/external/source/sugar-toolkit/src/sugar/tutorius/tests/actiontests.py source/external/source/sugar-toolkit/src/sugar/tutorius/tests/run-tests.py --- (limited to 'src/sugar/tutorius/tests/propertiestests.py') diff --git a/src/sugar/tutorius/tests/propertiestests.py b/src/sugar/tutorius/tests/propertiestests.py index 4f4caac..45ba264 100644 --- a/src/sugar/tutorius/tests/propertiestests.py +++ b/src/sugar/tutorius/tests/propertiestests.py @@ -204,7 +204,7 @@ class TStringPropertyTest(unittest.TestCase): try: prop.set("My string is too big!") assert False, "String should not set to longer than max size" - except SizeConstraintError: + except MaxSizeConstraintError: pass except: assert False, "Wrong exception type thrown" @@ -218,7 +218,7 @@ class TStringPropertyTest(unittest.TestCase): try: prop = TStringProperty("This is normal", 5) assert False, "Creation of the property should fail." - except SizeConstraintError: + except MaxSizeConstraintError: pass except: assert False, "Wrong exception type on failed constructor" @@ -236,26 +236,34 @@ class TArrayPropertyTest(unittest.TestCase): try_wrong_values(prop) - def test_size_limit(self): - prop = TArrayProperty([1,2], 4) + def test_size_limits(self): + prop = TArrayProperty([1,2], None, 4) try: prop.set([1,2,4,5,6,7]) - assert False, "Size limit constraint was not properly applied" - except SizeConstraintError: + assert False, "Maximum size limit constraint was not properly applied" + except MaxSizeConstraintError: + pass + + prop = TArrayProperty([1,2,3,4], 2) + + try: + prop.set([1]) + assert False, "Minimum size limit constraint was not properly applied" + except MinSizeConstraintError: pass - except: - assert False, "Wrong type of exception thrown" - def test_failing_constructor(self): try: - prop = TArrayProperty([100, 0, 20], 2) + prop = TArrayProperty([100, 0, 20], None, 2) assert False, "Creation of the property should fail." - except SizeConstraintError: + except MaxSizeConstraintError: + pass + try: + prop = TArrayProperty([100, 0, 20], 4, None) + assert False, "Creation of the property should fail." + except MinSizeConstraintError: pass - except: - assert False, "Wrong exception type on failed constructor" class TColorPropertyTest(unittest.TestCase): def test_basic_color(self): -- cgit v0.9.1