diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-04-06 02:38:10 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-04-16 00:52:40 (GMT) |
commit | 0cad6dc96afc2ebd4d03beb14ed01bc155dfa322 (patch) | |
tree | d86b51b031aa5da74d3d7935020e468fa6ab4919 /src/sugar/tutorius/tests/propertiestests.py | |
parent | aefa4024904ec92034d108d94768a388e8f1a9f6 (diff) |
LP 348570 Core : Extending actions with the new properties, adding min /
max size to arrays
Diffstat (limited to 'src/sugar/tutorius/tests/propertiestests.py')
-rw-r--r-- | src/sugar/tutorius/tests/propertiestests.py | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/src/sugar/tutorius/tests/propertiestests.py b/src/sugar/tutorius/tests/propertiestests.py index 52a9a75..b54f849 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): |