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/propertiestests.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/propertiestests.py')
-rw-r--r-- | src/sugar/tutorius/tests/propertiestests.py | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/src/sugar/tutorius/tests/propertiestests.py b/src/sugar/tutorius/tests/propertiestests.py index 52a9a75..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): @@ -286,6 +294,8 @@ class TBooleanPropertyTest(unittest.TestCase): def test_basic_boolean(self): assert self.prop.value == False, "Could not set initial value via constructor" + assert self.prop.type == "boolean", "Wrong type for TBooleanProperty : %s"%self.prop.type + self.prop.set(True) assert self.prop.value == True, "Could not change the value via set" @@ -313,6 +323,8 @@ class TEnumPropertyTest(unittest.TestCase): def test_basic_enum(self): assert self.prop.value == "hello", "Could not set initial value on property" + assert self.prop.type == "enum", "Wrong type for TEnumProperty : %s"%self.prop.type + self.prop.set(True) assert self.prop.value, "Could not change the value via set" @@ -333,6 +345,8 @@ class TFilePropertyTest(unittest.TestCase): def test_basic_file(self): assert self.prop.value == "propertiestests.py", "Could not set initial value" + assert self.prop.type == "file", "Wrong type for TFileProperty : %s"%self.prop.type + self.prop.set("run-tests.py") assert self.prop.value == "run-tests.py", "Could not change value" |