diff options
author | mike <michael.jmontcalm@gmail.com> | 2009-04-26 21:42:20 (GMT) |
---|---|---|
committer | mike <michael.jmontcalm@gmail.com> | 2009-04-26 21:42:20 (GMT) |
commit | 2a1c6d6fbcb60c44d8690add635260faf243dcd6 (patch) | |
tree | 25b10b497c515416370cbc0dd86e05bd6a2f4155 /src/sugar/tutorius/tests/constraintstests.py | |
parent | a4114a946cc7a57c1cfce5760737c3f05425bc86 (diff) | |
parent | e784a2f0b92ecaf46a77ddca94b31fcc86e0cbae (diff) |
(LP 352437) Core : Completed basic serializer interactions with core
(actions, event filters) - needs tests
Also, merged branch 'mike' into jc_support
Conflicts:
source/external/source/sugar-toolkit/src/sugar/tutorius/actions.py
source/external/source/sugar-toolkit/src/sugar/tutorius/bundler.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/run-tests.py
source/external/source/sugar-toolkit/src/sugar/tutorius/tests/serializertests.py
Diffstat (limited to 'src/sugar/tutorius/tests/constraintstests.py')
-rw-r--r-- | src/sugar/tutorius/tests/constraintstests.py | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/src/sugar/tutorius/tests/constraintstests.py b/src/sugar/tutorius/tests/constraintstests.py index 407cc24..b7b0a47 100644 --- a/src/sugar/tutorius/tests/constraintstests.py +++ b/src/sugar/tutorius/tests/constraintstests.py @@ -77,28 +77,50 @@ class LowerLimitConstraintTest(unittest.TestCase): except LowerLimitConstraintError: assert True, "Validation of LowerLimit(10) on 20 should not raise an exception" -class SizeConstraintTest(unittest.TestCase): +class MaxSizeConstraintTest(unittest.TestCase): def test_empty_constraint(self): - cons = SizeConstraint(None) + cons = MaxSizeConstraint(None) try: cons.validate(20) - except SizeConstraintError: + except MaxSizeConstraintError: assert False, "Empty contraint should not raise an exception" def test_validate(self): - cons = SizeConstraint(10) + cons = MaxSizeConstraint(10) try: cons.validate(range(0, 20)) - assert False, "Validation of SizeLimit(10) on list of length 20 should raise an exception" - except SizeConstraintError: + assert False, "Validation of MaxSizeConstraint(10) on list of length 20 should raise an exception" + except MaxSizeConstraintError: pass try: cons.validate(range(0,5)) - except SizeConstraintError: - assert True, "Validation of SizeLimit(10) on list of length 5 should not raise an exception" + except MaxSizeConstraintError: + assert True, "Validation of MaxSizeConstraint(10) on list of length 5 should not raise an exception" +class MinSizeConstraintTest(unittest.TestCase): + def test_empty_constraint(self): + cons = MinSizeConstraint(None) + try: + cons.validate(20) + except MinSizeConstraintError: + assert False, "Empty contraint should not raise an exception" + + def test_validate(self): + cons = MinSizeConstraint(10) + + try: + cons.validate(range(0, 5)) + assert False, "Validation of MinSizeConstraint(10) on list of length 20 should raise an exception" + except MinSizeConstraintError: + pass + + try: + cons.validate(range(0,20)) + except MinSizeConstraintError: + assert True, "Validation of MinSizeConstraint(10) on list of length 5 should not raise an exception" + class ColorConstraintTest(unittest.TestCase): def test_validate(self): cons = ColorConstraint() |