[Zope-Checkins] CVS: Zope3/lib/python/Schema/tests - testDictField.py:1.2 testListField.py:1.4 testStrField.py:1.2 testTupleField.py:1.4

Martijn Faassen m.faassen@vet.uu.nl
Sun, 14 Jul 2002 16:00:57 -0400


Update of /cvs-repository/Zope3/lib/python/Schema/tests
In directory cvs.zope.org:/tmp/cvs-serv23062/tests

Modified Files:
	testDictField.py testListField.py testStrField.py 
	testTupleField.py 
Log Message:
Beginnings of a refactoring of Validator. Mostly renaming and some
changes to the hierarchy. Actually I hope the hierarchy inside Validator
can mostly go away in favor of one of Fields, later (maintaining two
related hierarchies is a pain).

Also some bugfixes (missing ValidationError import) to the tests. Though
now I'm wondering whether we need a try.. except ValidationError in the
tests at all; it seems to obscure the tests more than they help, so removing
the 'try' and 'except' and simply letting the block of code unprotected
may be better -- any unexpected ValidationError will cause the test to
fail with an error.


=== Zope3/lib/python/Schema/tests/testDictField.py 1.1 => 1.2 ===
 from unittest import TestSuite, main, makeSuite
 from Schema import Dict, Int, Float, ErrorNames
 from testField import FieldTest
+from Schema.Exceptions import ValidationError
 
 class DictTest(FieldTest):
     """Test the Dict Field."""
@@ -91,12 +92,13 @@
         field = Dict(id="field", title='Dict field',
                            description='', readonly=0, required=0,
                            value_types=(Int, Float))
-        try:
-            field.validate(None)
-            field.validate({'a': 5.3})
-            field.validate({'a': 2, 'b': 2.3})
-        except ValidationError, e:
-            self.unexpectedValidationError(e)
+        #try:
+        field.validate(None)
+        field.validate({'a': 5.3})
+        field.validate({'a': 2, 'b': 2.3})
+
+        #except ValidationError, e:
+        #    self.unexpectedValidationError(e)
         self.assertRaisesErrorNames(ErrorNames.WrongContainedType,
                                     field.validate, {1: ''} )
         self.assertRaisesErrorNames(ErrorNames.WrongContainedType,


=== Zope3/lib/python/Schema/tests/testListField.py 1.3 => 1.4 ===
 from unittest import TestSuite, main, makeSuite
 from Schema import List, Int, Float, ErrorNames
 from testField import FieldTest
+from Schema.Exceptions import ValidationError
 
 class ListTest(FieldTest):
     """Test the List Field."""


=== Zope3/lib/python/Schema/tests/testStrField.py 1.1 => 1.2 ===
 from unittest import TestSuite, main, makeSuite
 from Schema import Str, ErrorNames
 from testField import FieldTest
+from Schema.Exceptions import ValidationError
 
 class StrTest(FieldTest):
     """Test the Str Field."""


=== Zope3/lib/python/Schema/tests/testTupleField.py 1.3 => 1.4 ===
 from unittest import TestSuite, main, makeSuite
 from Schema import Tuple, Int, Float, ErrorNames
 from testField import FieldTest
+from Schema.Exceptions import ValidationError
 
 class TupleTest(FieldTest):
     """Test the Tuple Field."""