Changeset 5369 for main/waeup.widgets.core/trunk/src/waeup
- Timestamp:
- 4 Aug 2010, 19:15:31 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.widgets.core/trunk/src/waeup/widgets/core/tests/test_dictwidget.py
r5366 r5369 36 36 from zope.formlib.widgets import SequenceWidget 37 37 from zope.formlib.interfaces import IDisplayWidget 38 from zope.formlib.interfaces import IInputWidget, MissingInputError 38 from zope.formlib.interfaces import ( 39 IInputWidget, MissingInputError, WidgetInputError) 39 40 from zope.formlib.interfaces import IWidgetInputError, WidgetInputError 40 41 from zope.formlib.interfaces import IWidgetInputErrorView … … 106 107 IWidgetInputErrorView, '') 107 108 109 def test_brokenTypeFields(self): 110 """Artificially construct the case, that value_type or key_type of the 111 field are not set. This is merely to keep test coverage 112 happy. 113 """ 114 request = TestRequest(form={'field.foo.key.0.bar': u'Hello', 115 'field.foo.value.0.baz': u'world!', 116 'field.foo.count': u'1'}) 117 broken_field =self.field 118 broken_field.key_type = None 119 widget = DictWidget( 120 self.field, request) 121 assert widget._getRenderedValue() == {} 122 123 broken_field.value_type = None 124 widget = DictWidget( 125 self.field, request) 126 assert widget._getRenderedValue() == {} 127 128 def test_invalidCount(self): 129 # If we get a count which is not a number, fail... 130 request = TestRequest(form={'field.foo.key.0.bar': u'Hello', 131 'field.foo.value.0.baz': u'world!', 132 'field.foo.count': u'a'}) 133 widget = DictWidget( 134 self.field, request) 135 self.assertRaises(WidgetInputError, widget.getInputValue) 136 108 137 def test_haveNoData(self): 109 138 self.failIf(self._widget.hasInput()) … … 154 183 self.field, request, subwidget=ow) 155 184 assert widget.subwidget is ow 185 assert widget() is not None 156 186 157 187 def test_dict(self):
Note: See TracChangeset for help on using the changeset viewer.