[Zope3-checkins] CVS: Zope3/src/zope/app/form/tests - test_utility.py:1.9
Steve Alexander
steve@cat-box.net
Fri, 21 Feb 2003 12:52:49 -0500
Update of /cvs-repository/Zope3/src/zope/app/form/tests
In directory cvs.zope.org:/tmp/cvs-serv20293/src/zope/app/form/tests
Modified Files:
test_utility.py
Log Message:
Made the exception raised by getWidgetsData more regular.
Changed widget_name to field_name, because that's what it should be.
=== Zope3/src/zope/app/form/tests/test_utility.py 1.8 => 1.9 ===
--- Zope3/src/zope/app/form/tests/test_utility.py:1.8 Fri Feb 21 09:53:33 2003
+++ Zope3/src/zope/app/form/tests/test_utility.py Fri Feb 21 12:52:18 2003
@@ -26,8 +26,7 @@
from zope.interface import Interface
from zope.schema import Text
from zope.app.browser.form.widget import TextWidget
-from zope.component.view \
- import provideView, setDefaultViewName
+from zope.component.view import provideView, setDefaultViewName
from zope.schema.interfaces import IText
from zope.app.interfaces.form import WidgetsError, MissingInputError
from zope.app.form.utility import setUpWidget, setUpWidgets, setUpEditWidgets
@@ -426,16 +425,20 @@
request = TestRequest()
view = BrowserView(c, request)
setUpWidgets(view, I, initial=kw(title=u"ttt", description=u"ddd"))
- self.assertEqual(getWidgetsData(view, I, strict=False, set_missing=False),
- {})
+ self.assertEqual(
+ getWidgetsData(view, I, strict=False, set_missing=False),
+ {})
+
+ self.assertEqual(
+ getWidgetsData(view, I, strict=False, set_missing=True),
+ {'description': None, 'title': None})
+
+ # XXX check that the WidgetsError contains a MissingInputError
+ self.assertRaises(WidgetsError,
+ getWidgetsData, view, I2, strict=True)
- self.assertEqual(getWidgetsData(view, I, strict=False, set_missing=True),
- {'description': None, 'title': None})
-
- self.assertRaises(MissingInputError, getWidgetsData, view, I2, strict=True)
-
- self.assertEqual(getWidgetsData(view, I), {'description': None,
- 'title': None})
+ self.assertEqual(getWidgetsData(view, I),
+ {'description': None, 'title': None})
request.form['field.description'] = u'fd'
self.assertEqual(getWidgetsData(view, I2, strict=False,
@@ -446,7 +449,8 @@
set_missing=True),
{'description': u'fd', 'title': None})
- self.assertRaises(MissingInputError, getWidgetsData, view, I2)
+ # XXX check that the WidgetsError contains a MissingInputError
+ self.assertRaises(WidgetsError, getWidgetsData, view, I2)
self.assertEqual(getWidgetsData(view, I), {'description': u'fd',
'title': None})
@@ -491,9 +495,6 @@
setUpWidgets(view, I2, initial=kw(title=u"ttt", description=u"ddd"))
self.assertEqual(c.title, u'old title')
self.assertEqual(c.description, u'old description')
-
-
-
def test_suite():
return TestSuite((