This file is indexed.

/usr/share/pyshared/zope/formlib/tests/test_formlib.py is in python-zope.formlib 4.0.5-0ubuntu5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
##############################################################################
#
# Copyright (c) 2005 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import unittest
import re
import pytz

from zope.component.testing import setUp, tearDown
from zope.component import adapter
from zope.component import adapts
from zope.component import provideAdapter, provideUtility

from zope.i18n.testing import setUp as i18nSetUp
import zope.interface.common.idatetime
import zope.publisher.interfaces
import zope.publisher.interfaces.browser
import zope.schema.interfaces
import zope.testing.renormalizing
import zope.traversing.adapters

from zope.formlib.widgets import (
    TextWidget, FloatWidget, UnicodeDisplayWidget, IntWidget,
    DatetimeDisplayWidget, DatetimeWidget)

from zope.formlib import exception
from zope.formlib.interfaces import IWidgetInputErrorView

import zope.formlib
import zope.formlib.form
import zope.formlib.interfaces
from zope.browserpage.namedtemplate import NamedTemplateImplementation

from zope.configuration.xmlconfig import XMLConfig

@zope.interface.implementer(zope.interface.common.idatetime.ITZInfo)
@adapter(zope.publisher.interfaces.IRequest)
def requestToTZInfo(request):
    return pytz.timezone('US/Hawaii')

def pageSetUp(test):
    setUp(test)
    provideAdapter(
        zope.traversing.adapters.DefaultTraversable,
        [None],
        )

@adapter(zope.formlib.interfaces.IForm)
@NamedTemplateImplementation
def TestTemplate(self):
    status = self.status
    if status:
        status = zope.i18n.translate(status,
                                     context=self.request,
                                     default=self.status)
        if getattr(status, 'mapping', 0):
            status = zope.i18n.interpolate(status, status.mapping)
        print status

    result = []

    if self.errors:
        for error in self.errors:
            result.append("%s: %s" % (error.__class__.__name__, error))

    for w in self.widgets:
        result.append(w())
        error = w.error()
        if error:
            result.append(str(error))

    for action in self.availableActions():
        result.append(action.render())

    return '\n'.join(result)

def formSetUp(test):
    setUp(test)
    i18nSetUp(test)
    provideAdapter(
        TextWidget,
        [zope.schema.interfaces.ITextLine,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IInputWidget,
        )
    provideAdapter(
        FloatWidget,
        [zope.schema.interfaces.IFloat,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IInputWidget,
        )
    provideAdapter(
        UnicodeDisplayWidget,
        [zope.schema.interfaces.IInt,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IDisplayWidget,
        )
    provideAdapter(
        IntWidget,
        [zope.schema.interfaces.IInt,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IInputWidget,
        )
    provideAdapter(
        UnicodeDisplayWidget,
        [zope.schema.interfaces.IFloat,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IDisplayWidget,
        )
    provideAdapter(
        UnicodeDisplayWidget,
        [zope.schema.interfaces.ITextLine,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IDisplayWidget,
        )
    provideAdapter(
        DatetimeDisplayWidget,
        [zope.schema.interfaces.IDatetime,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IDisplayWidget,
        )
    provideAdapter(
        DatetimeWidget,
        [zope.schema.interfaces.IDatetime,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        zope.formlib.interfaces.IInputWidget,
        )
    provideAdapter(
        exception.WidgetInputErrorView,
        [zope.formlib.interfaces.IWidgetInputError,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        IWidgetInputErrorView,
        )
    provideAdapter(
        zope.formlib.errors.InvalidErrorView,
        [zope.interface.Invalid,
         zope.publisher.interfaces.browser.IBrowserRequest,
         ],
        IWidgetInputErrorView,
        )
    provideAdapter(TestTemplate, name='default')
    provideAdapter(requestToTZInfo)
    provideAdapter(
        zope.formlib.form.render_submit_button, name='render')

    XMLConfig('ftesting.zcml', zope.formlib)

# Classes used in tests

class IOrder(zope.interface.Interface):
    identifier = zope.schema.Int(title=u"Identifier", readonly=True)
    name = zope.schema.TextLine(title=u"Name")
    min_size = zope.schema.Float(title=u"Minimum size")
    max_size = zope.schema.Float(title=u"Maximum size")
    now = zope.schema.Datetime(title=u"Now", readonly=True)

class IDescriptive(zope.interface.Interface):
    title = zope.schema.TextLine(title=u"Title")
    description = zope.schema.TextLine(title=u"Description")


class Order:
    zope.interface.implements(IOrder)
    identifier = 1
    name = 'unknown'
    min_size = 1.0
    max_size = 10.0


class Descriptive(object):
    adapts(IOrder)
    zope.interface.implements(IDescriptive)
    def __init__(self, context):
        self.context = context

    def title():
        def get(self):
            try:
                return self.context.__title
            except AttributeError:
                return ''
        def set(self, v):
            self.context.__title = v
        return property(get, set)
    title = title()

    def description():
        def get(self):
            try:
                return self.context.__description
            except AttributeError:
                return ''
        def set(self, v):
            self.context.__description = v
        return property(get, set)
    description = description()


def makeSureRenderCanBeCalledWithoutCallingUpdate():
    """\

    >>> class MyForm(zope.formlib.form.EditForm):
    ...     form_fields = zope.formlib.form.fields(
    ...         IOrder, keep_readonly=['identifier'])

    >>> from zope.publisher.browser import TestRequest
    >>> myform = MyForm(Order(), TestRequest())
    >>> print myform.render() # doctest: +NORMALIZE_WHITESPACE
    1
    <input class="textType" id="form.name" name="form.name"
           size="20" type="text" value="unknown"  />
    <input class="textType" id="form.min_size" name="form.min_size"
           size="10" type="text" value="1.0"  />
    <input class="textType" id="form.max_size" name="form.max_size"
           size="10" type="text" value="10.0"  />
    <input type="submit" id="form.actions.apply" name="form.actions.apply"
           value="Apply" class="button" />

"""

def make_sure_i18n_is_called_correctly_for_actions():
    """\

We want to make sure that i18n is called correctly.  This is in
response to a bug that occurred because actions called i18n.translate
with incorrect positional arguments.

We'll start by setting up an action:

    >>> import zope.i18nmessageid
    >>> _ = zope.i18nmessageid.MessageFactory('my.domain')
    >>> action = zope.formlib.form.Action(_("MyAction"))

Actions get bound to forms.  We'll set up a test request, create a
form for it and bind the action to the form:

    >>> myform = zope.formlib.form.FormBase(None, 42)
    >>> action = action.__get__(myform)

Button labels are rendered by form.render_submit_button, passing the
bound action.  Before we call this however, we need to set up a dummy
translation domain.  We'll create one for our needs:

    >>> import zope.i18n.interfaces
    >>> class MyDomain:
    ...     zope.interface.implements(zope.i18n.interfaces.ITranslationDomain)
    ...
    ...     def translate(self, msgid, mapping=None, context=None,
    ...                   target_language=None, default=None):
    ...         print msgid
    ...         print mapping
    ...         print context
    ...         print target_language
    ...         print default
    ...         return msgid

    >>> provideUtility(MyDomain(), name='my.domain')

Now, if we call render_submit_button, we should be able to verify the
data passed to translate:

    >>> zope.formlib.form.render_submit_button(action)() # doctest: +NORMALIZE_WHITESPACE
    MyAction
    None
    42
    None
    MyAction
    u'<input type="submit" id="form.actions.myaction"
       name="form.actions.myaction" value="MyAction" class="button" />'


"""

def test_error_handling():
    """\

Let's test the getWidgetsData method which is responsible for handling widget
erros raised by the widgets getInputValue method.

    >>> import zope.formlib.interfaces
    >>> class Widget(object):
    ...     zope.interface.implements(zope.formlib.interfaces.IInputWidget)
    ...     def __init__(self):
    ...         self.name = 'form.summary'
    ...         self.label = 'Summary'
    ...     def hasInput(self):
    ...         return True
    ...     def getInputValue(self):
    ...         raise zope.formlib.interfaces.WidgetInputError(
    ...         field_name='summary',
    ...         widget_title=u'Summary')
    >>> widget = Widget()
    >>> inputs = [(True, widget)]
    >>> widgets = zope.formlib.form.Widgets(inputs, 5)
    >>> errors = zope.formlib.form.getWidgetsData(widgets, 'form', {'summary':'value'})
    >>> errors #doctest: +ELLIPSIS
    [<zope.formlib.interfaces.WidgetInputError instance at ...>]

Let's see what happens if a widget doesn't convert a ValidationError
raised by a field to a WidgetInputError. This should not happen if a widget
converts ValidationErrors to WidgetInputErrors. But since I just fixed
yesterday the sequence input widget, I decided to catch ValidationError also
in the formlib as a fallback if some widget doen't handle errors correct. (ri)

    >>> class Widget(object):
    ...     zope.interface.implements(zope.formlib.interfaces.IInputWidget)
    ...     def __init__(self):
    ...         self.name = 'form.summary'
    ...         self.label = 'summary'
    ...     def hasInput(self):
    ...         return True
    ...     def getInputValue(self):
    ...         raise zope.schema.interfaces.ValidationError('A error message')
    >>> widget = Widget()
    >>> inputs = [(True, widget)]
    >>> widgets = zope.formlib.form.Widgets(inputs, 5)
    >>> errors = zope.formlib.form.getWidgetsData(widgets, 'form', {'summary':'value'})
    >>> errors #doctest: +ELLIPSIS
    [<zope.formlib.interfaces.WidgetInputError instance at ...>]

"""

def test_form_template_i18n():
    """\
Let's try to check that the formlib templates handle i18n correctly.
We'll define a simple form:

    >>> from zope.browserpage import ViewPageTemplateFile
    >>> import zope.i18nmessageid
    >>> _ = zope.i18nmessageid.MessageFactory('my.domain')

    >>> class MyForm(zope.formlib.form.Form):
    ...     label = _('The label')
    ...     status = _('Success!')
    ...     form_fields = zope.formlib.form.Fields(
    ...         zope.schema.TextLine(__name__='name',
    ...                              title=_("Name"),
    ...                              description=_("Enter your name"),
    ...                             ),
    ...         )
    ...     @zope.formlib.form.action(_('Ok'))
    ...     def ok(self, action, data):
    ...         pass
    ...     page = ViewPageTemplateFile("../pageform.pt")
    ...     subpage = ViewPageTemplateFile("../subpageform.pt")

Now, we should be able to create a form instance:

    >>> from zope.publisher.browser import TestRequest
    >>> request = TestRequest()
    >>> form = MyForm(object(), request)

Unfortunately, the "page" template uses a page macro. We need to
provide a template that it can get one from.  Here, we'll set up a
view that provides the necessary macros:

    >>> from zope.pagetemplate.pagetemplate import PageTemplate
    >>> macro_template = PageTemplate()
    >>> macro_template.write('''\
    ... <html metal:define-macro="view">
    ... <body metal:define-slot="body" />
    ... </html>
    ... ''')

We also need to provide a traversal adapter for the view namespace
that lets us look up the macros.

    >>> import zope.traversing.interfaces
    >>> class view:
    ...     adapts(None, None)
    ...     zope.interface.implements(zope.traversing.interfaces.ITraversable)
    ...     def __init__(self, ob, r=None):
    ...         pass
    ...     def traverse(*args):
    ...         return macro_template.macros

    >>> provideAdapter(view, name='view')

And we have to register the default traversable adapter (I wish we had
push templates):

    >>> from zope.traversing.adapters import DefaultTraversable
    >>> provideAdapter(DefaultTraversable, [None])

We need to set up the translation framework. We'll just provide a
negotiator that always decides to use the test language:

    >>> import zope.i18n.interfaces
    >>> class Negotiator:
    ...     zope.interface.implements(zope.i18n.interfaces.INegotiator)
    ...     def getLanguage(*ignored):
    ...         return 'test'

    >>> provideUtility(Negotiator())

And we'll set up the fallback-domain factory, which provides the test
language for all domains:

    >>> from zope.i18n.testmessagecatalog import TestMessageFallbackDomain
    >>> provideUtility(TestMessageFallbackDomain)

OK, so let's see what the page form looks like. First, we'll compute
the page:

    >>> form.update()
    >>> page = form.page()

We want to make sure that the page has the translations we expect and
that it doesn't double translate anything.  We'll write a generator
that extracts the translations, complaining if any are nested:

    >>> def find_translations(text):
    ...     l = 0
    ...     while 1:
    ...         lopen = text.find('[[', l)
    ...         lclose = text.find(']]', l)
    ...         if lclose >= 0 and lclose < lopen:
    ...             raise ValueError(lopen, lclose, text)
    ...         if lopen < 0:
    ...             break
    ...         l = lopen + 2
    ...         lopen = text.find('[[', l)
    ...         lclose = text.find(']]', l)
    ...         if lopen >= 0 and lopen < lclose:
    ...             raise ValueError(lopen, lclose, text)
    ...         if lclose < 0:
    ...             raise ValueError(l, text)
    ...         yield text[l-2:lclose+2]
    ...         l = lclose + 2

    >>> for t in find_translations(page):
    ...     print t
    [[my.domain][The label]]
    [[my.domain][Success!]]
    [[my.domain][Name]]
    [[my.domain][Enter your name]]
    [[my.domain][Ok]]

Now, let's try the same thing with the sub-page form:

    >>> for t in find_translations(form.subpage()):
    ...     print t
    [[my.domain][The label]]
    [[my.domain][Success!]]
    [[my.domain][Name]]
    [[my.domain][Enter your name]]
    [[my.domain][Ok]]

"""


def test_setUpWidgets_prefix():
    """This is a regression test for field prefix handling in setUp*Widgets.

    Let's set up fields with some interface and a prefix on fields:

        >>> from zope.formlib import form
        >>> from zope import interface, schema

        >>> class ITrivial(interface.Interface):
        ...     name = schema.TextLine(title=u"Name")

        >>> form_fields = form.Fields(ITrivial, prefix='one')
        >>> form_fields += form.Fields(ITrivial, prefix='two')
        >>> form_fields += form.Fields(ITrivial, prefix='three')

    Let's call setUpDataWidgets and see their names:

        >>> class Trivial(object):
        ...     interface.implements(ITrivial)
        ...     name = 'foo'
        >>> context = Trivial()

        >>> from zope.publisher.browser import TestRequest
        >>> request = TestRequest()

        >>> widgets = form.setUpDataWidgets(form_fields, 'form', context,
        ...                                 request, {})
        >>> [w.name for w in widgets]
        ['form.one.name', 'form.two.name', 'form.three.name']

    Let's try the same with setUpEditWidgets:

        >>> widgets = form.setUpEditWidgets(form_fields, 'form', context,
        ...                                  request)
        >>> [w.name for w in widgets]
        ['form.one.name', 'form.two.name', 'form.three.name']

    And setUpInputWidgets:

        >>> widgets = form.setUpInputWidgets(form_fields, 'form', context,
        ...                                  request)
        >>> [w.name for w in widgets]
        ['form.one.name', 'form.two.name', 'form.three.name']

    And setUpWidgets:

        >>> widgets = form.setUpWidgets(form_fields, 'form', context, request)
        >>> [w.name for w in widgets]
        ['form.one.name', 'form.two.name', 'form.three.name']

    """

def check_action_name():
    """
We want to make sure that Action name setting adheres to the specification.

With just label, with increasing complexity:

    >>> action = zope.formlib.form.Action("MyAction")
    >>> action.name
    'myaction'

    >>> action = zope.formlib.form.Action("8 Balls")
    >>> action.name
    '382042616c6c73'

    >>> action = zope.formlib.form.Action(u"MyAction")
    >>> action.name
    u'myaction'

    >>> action = zope.formlib.form.Action(u"8 Balls")
    >>> action.name
    '382042616c6c73'

    >>> action = zope.formlib.form.Action(u'\u9001\u4fe1')
    >>> action.name
    'e98081e4bfa1'

    >>> import zope.i18nmessageid
    >>> _ = zope.i18nmessageid.MessageFactory('my.domain')

    >>> action = zope.formlib.form.Action(_(u"MyAction"))
    >>> action.name
    u'myaction'

    >>> action = zope.formlib.form.Action(_(u"8 Balls"))
    >>> action.name
    '382042616c6c73'

    >>> action = zope.formlib.form.Action(_(u'\u9001\u4fe1'))
    >>> action.name
    'e98081e4bfa1'

With all lowercase name:

    >>> action = zope.formlib.form.Action("MyAction", name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action("8 Balls", name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action(u"MyAction", name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action(u"8 Balls", name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action(u'\u9001\u4fe1', name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action(_(u"MyAction"), name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action(_(u"8 Balls"), name='foobar')
    >>> action.name
    'foobar'

    >>> action = zope.formlib.form.Action(_(u'\u9001\u4fe1'), name='foobar')
    >>> action.name
    'foobar'

With some uppercase name:

    >>> action = zope.formlib.form.Action("MyAction", name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action("8 Balls", name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action(u"MyAction", name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action(u"8 Balls", name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action(u'\u9001\u4fe1', name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action(_(u"MyAction"), name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action(_(u"8 Balls"), name='FooBar')
    >>> action.name
    'FooBar'

    >>> action = zope.formlib.form.Action(_(u'\u9001\u4fe1'), name='FooBar')
    >>> action.name
    'FooBar'

"""


def test_suite():
    import doctest
    checker = zope.testing.renormalizing.RENormalizing([
      (re.compile(r"\[WidgetInputError\('form.summary', 'summary', ValidationError\('A error message'\)\)\]"),
                  r"[<zope.formlib.interfaces.WidgetInputError instance at ...>]"),
      (re.compile(r"\[WidgetInputError\('summary', u'Summary', None\)\]"),
                  r"[<zope.formlib.interfaces.WidgetInputError instance at ...>]"),
      (re.compile(r" ValueError\('invalid literal for float\(\): (bob'|10/0'),\)"),
                  r"\n <exceptions.ValueError instance at ...>"),
      (re.compile(r" ValueError\('could not convert string to float: bob',\)"),
                  r"\n <exceptions.ValueError instance at ...>"),
    ])
    return unittest.TestSuite((
        doctest.DocFileSuite(
            '../errors.txt',
            setUp=formSetUp, tearDown=tearDown,
            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
            ),
        # The following test needs some zope.security test setup
        #doctest.DocFileSuite(
        #     'bugs.txt',
        #     setUp=formSetUp, tearDown=tearDown,
        #     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
        #     ),
        doctest.DocFileSuite(
            '../form.txt',
            setUp=formSetUp, tearDown=tearDown,
            optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
            checker=checker
            ),
        doctest.DocTestSuite(
            setUp=formSetUp, tearDown=tearDown,
            checker=checker
            ),
        doctest.DocTestSuite(
            'zope.formlib.errors'),
        ))

if __name__ == '__main__':
    unittest.main(defaultTest='test_suite')