[Zope3-checkins] CVS: Zope3/src/zope/schema/tests - test_schema.py:1.3
Jim Fulton
jim@zope.com
Thu, 9 Jan 2003 09:13:22 -0500
Update of /cvs-repository/Zope3/src/zope/schema/tests
In directory cvs.zope.org:/tmp/cvs-serv14386/src/zope/schema/tests
Modified Files:
test_schema.py
Log Message:
- Got rid of (essentially) unused validateMapping, validateMappingAll,
ValidationErrorsAll and ConversionErrorsAll.
- Renamed zope.app.interfaces.forms to zope.app.interfaces.form
- Changed the way form input errors are handled. Now, *only*
validation errors and widget input errors are caught and displayed
on forms. These errors are about data entry problems. For these, it
never makes sense to show a traceback.
For Python programming errors, we want tracebacks, so it's important
to handle them differently, but letting the propigate and get logged
by the error reporting service.
This required updating the widget code to be more careful about
errors raised.
=== Zope3/src/zope/schema/tests/test_schema.py 1.2 => 1.3 ===
--- Zope3/src/zope/schema/tests/test_schema.py:1.2 Wed Dec 25 09:15:21 2002
+++ Zope3/src/zope/schema/tests/test_schema.py Thu Jan 9 09:13:20 2003
@@ -15,13 +15,11 @@
$Id$
"""
from unittest import TestCase, TestSuite, main, makeSuite
-from zope.schema.interfaces import StopValidation, ValidationError, \
- ValidationErrorsAll
+from zope.schema.interfaces import StopValidation, ValidationError
from zope.interface import Interface
from zope.schema import Bytes
from zope.schema.errornames import RequiredMissing
-from zope.schema import validateMapping, validateMappingAll,\
- getFields, getFieldsInOrder
+from zope.schema import getFields, getFieldsInOrder
class ISchemaTest(Interface):
title = Bytes(
@@ -43,42 +41,6 @@
required=True)
class SchemaTest(TestCase):
-
- def testValidateMapping(self):
- dict = {'title': 'A title',
- 'description': 'A particular description.',
- 'spam': 'Spam'}
- try:
- validateMapping(ISchemaTest, dict)
- except ValidationError, e:
- self.fail("Unexpected ValidationError: %s" % e.error_name)
-
- def testValidateBadMapping(self):
- dict = {'title': 'A title'}
- self.assertRaises(ValidationError, validateMapping, ISchemaTest, dict)
-
- def testValidateMappingAll(self):
- dict = {'title': 'A title',
- 'description': 'A particular description.',
- 'spam': 'Spam',
- }
- try:
- validateMappingAll(ISchemaTest, dict)
- except ValidationErrorsAll:
- self.fail("Unexpected ValidationErrors")
-
- def test_validateBadMappingAll(self):
- dict = {'title': 'A title'}
- try:
- validateMappingAll(ISchemaTest, dict)
- except ValidationErrorsAll, e:
- error=ValidationError(RequiredMissing)
- self.assertEqual(e.errors ,
- [('description',error), ('spam',error)])
- self.assertRaises(ValidationError, validateMapping, ISchemaTest,
- dict)
- return
- self.fail('Expected ValidationErrors, but none detected')
def test_getFields(self):
fields = getFields(ISchemaTest)