From f6586759bac2974a4b1790f5c0cd7e69baf26852 Mon Sep 17 00:00:00 2001 From: "Christian Tremblay, ing" Date: Tue, 18 Aug 2015 22:02:24 -0400 Subject: [PATCH] Modified object_cannot_write_wrong_property_to_writableProperty() so try/except catch won't quit before testing every properties. Signed-off-by: Christian Tremblay, ing. --- tests/test_objects/helper.py | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/tests/test_objects/helper.py b/tests/test_objects/helper.py index 84f150a..820043f 100644 --- a/tests/test_objects/helper.py +++ b/tests/test_objects/helper.py @@ -128,18 +128,25 @@ class TestObjectHelper(): def object_cannot_write_wrong_property_to_writableProperty(self, obj): if _debug: self._debug("test_object_%s_can_write_to_writableProperty" % obj.objectType) - try: - for each in self.listOfProperties: - if each[0] == WritableProperty: - actualDatatype = each[2] - actualProperty = each[1] - - for each in TestObjectHelper.writeValues: - if not isinstance(each,actualDatatype): - if _debug: self._debug("actualDatatype : %s / actualProperty : %s | value : %s" % (actualDatatype,actualProperty, each)) + nmbrOfSuccess = 0 + nmbrOfFailures = 0 + nmbrOfWritableProperties = 0 + + for each in self.listOfProperties: + if each[0] == WritableProperty: + nmbrOfWritableProperties += 1 + actualDatatype = each[2] + actualProperty = each[1] + for each in TestObjectHelper.writeValues: + if not isinstance(each,actualDatatype): + if _debug: self._debug("actualDatatype : %s / actualProperty : %s | value : %s" % (actualDatatype,actualProperty, each)) + try: obj.WriteProperty(actualProperty,each) - except (TypeError, ValueError): - assert True + nmbrOfSuccess += 1 + except (TypeError, ValueError): + nmbrOfFailures += 1 + self.assertEqual(nmbrOfSuccess,0) + #self.assertEqual(nmbrOfWritableProperties,nmbrOfFailures) def object_can_read_property(self, obj): if _debug: self._debug("test_object_%s_can_read_property" % obj.objectType)