• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

zopefoundation / z3c.form / 16248976312

02 Jul 2025 05:53AM UTC coverage: 95.275%. Remained the same
16248976312

push

github

icemac
Back to development: 6.1

717 of 800 branches covered (89.63%)

Branch coverage included in aggregate %.

3699 of 3835 relevant lines covered (96.45%)

0.96 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.67
/src/z3c/form/tests/test_doc.py
1
##############################################################################
2
#
3
# Copyright (c) 2007 Zope Foundation and Contributors.
4
# All Rights Reserved.
5
#
6
# This software is subject to the provisions of the Zope Public License,
7
# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
8
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11
# FOR A PARTICULAR PURPOSE.
12
#
13
##############################################################################
14
"""z3c.form Test Module"""
15

16
import doctest
1✔
17
import itertools
1✔
18
import re
1✔
19
import unittest
1✔
20

21
from zope.testing import renormalizing
1✔
22

23
from z3c.form import testing
1✔
24

25

26
# This package will allways provide z3c.pt for it's test setup.
27
# The Z3CPT_AVAILABLE hickup is usefull if someone will run the z3c.form tests
28
# in his own project and doesn't use z3c.pt.
29
try:
1✔
30
    import z3c.pt
1✔
31
    import z3c.ptcompat  # noqa: F401 imported but unused
×
32
    Z3CPT_AVAILABLE = True
×
33
except ModuleNotFoundError:
1✔
34
    Z3CPT_AVAILABLE = False
1✔
35

36
try:
1✔
37
    import zope.app.container  # noqa: F401 imported but unused
1✔
38
except ModuleNotFoundError:
1✔
39
    ADDING_AVAILABLE = False
1✔
40
else:
41
    ADDING_AVAILABLE = True
×
42

43

44
def test_suite():
1✔
45
    flags = \
1✔
46
        doctest.NORMALIZE_WHITESPACE | \
47
        doctest.ELLIPSIS | \
48
        doctest.IGNORE_EXCEPTION_DETAIL
49

50
    if Z3CPT_AVAILABLE:
1!
51
        setups = (testing.setUpZPT, testing.setUpZ3CPT)
×
52
    else:
53
        setups = (testing.setUpZPT, )
1✔
54

55
    tests = ((
1✔
56
        doctest.DocFileSuite(
57
            '../form.rst',
58
            setUp=setUp, tearDown=testing.tearDown,
59
            optionflags=flags, checker=testing.outputChecker,
60
        ),
61
        doctest.DocFileSuite(
62
            '../action.rst',
63
            setUp=setUp, tearDown=testing.tearDown,
64
            optionflags=flags, checker=testing.outputChecker,
65
        ),
66
        doctest.DocFileSuite(
67
            '../datamanager.rst',
68
            setUp=setUp, tearDown=testing.tearDown,
69
            optionflags=flags, checker=testing.outputChecker,
70
        ),
71
        doctest.DocFileSuite(
72
            '../field.rst',
73
            setUp=setUp, tearDown=testing.tearDown,
74
            optionflags=flags, checker=testing.outputChecker,
75
        ),
76
        doctest.DocFileSuite(
77
            '../contentprovider.rst',
78
            setUp=setUp, tearDown=testing.tearDown,
79
            optionflags=flags, checker=testing.outputChecker,
80
        ),
81
        doctest.DocFileSuite(
82
            '../validator.rst',
83
            setUp=setUp, tearDown=testing.tearDown,
84
            optionflags=flags, checker=testing.outputChecker,
85
        ),
86
        doctest.DocFileSuite(
87
            '../error.rst',
88
            setUp=setUp, tearDown=testing.tearDown,
89
            optionflags=flags, checker=testing.outputChecker,
90
        ),
91
        doctest.DocFileSuite(
92
            '../widget.rst',
93
            setUp=setUp, tearDown=testing.tearDown,
94
            optionflags=flags, checker=testing.outputChecker,
95
        ),
96
        doctest.DocFileSuite(
97
            '../button.rst',
98
            setUp=setUp, tearDown=testing.tearDown,
99
            optionflags=flags, checker=testing.outputChecker,
100
        ),
101
        doctest.DocFileSuite(
102
            '../zcml.rst',
103
            setUp=setUp, tearDown=testing.tearDown,
104
            optionflags=flags, checker=testing.outputChecker,
105
        ),
106
        doctest.DocFileSuite(
107
            '../testing.rst',
108
            setUp=setUp, tearDown=testing.tearDown,
109
            optionflags=flags, checker=testing.outputChecker,
110
        ),
111
        doctest.DocFileSuite(
112
            '../converter.rst',
113
            setUp=setUp, tearDown=testing.tearDown,
114
            optionflags=flags, checker=renormalizing.RENormalizing([
115
                (re.compile(
116
                 r"(invalid literal for int\(\)) with base 10: '(.*)'"),
117
                 r'\1: \2'),
118
                (re.compile(
119
                 r"Decimal\('(.*)'\)"),
120
                 r'Decimal("\1")'),
121
            ]) + testing.outputChecker
122
        ),
123
        doctest.DocFileSuite(
124
            '../group.rst',
125
            setUp=setUp, tearDown=testing.tearDown,
126
            optionflags=flags, checker=testing.outputChecker,
127
        ),
128
        doctest.DocFileSuite(
129
            '../subform.rst',
130
            setUp=setUp, tearDown=testing.tearDown,
131
            optionflags=flags, checker=testing.outputChecker,
132
        ),
133
        doctest.DocFileSuite(
134
            '../term.rst',
135
            setUp=setUp, tearDown=testing.tearDown,
136
            optionflags=flags, checker=testing.outputChecker,
137
        ),
138
        doctest.DocFileSuite(
139
            '../util.rst',
140
            setUp=setUp, tearDown=testing.tearDown,
141
            optionflags=flags, checker=testing.outputChecker,
142
        ),
143
        doctest.DocFileSuite(
144
            '../hint.rst',
145
            setUp=setUp, tearDown=testing.tearDown,
146
            optionflags=flags, checker=testing.outputChecker,
147
        ),
148
        doctest.DocFileSuite(
149
            '../browser/widget.rst',
150
            setUp=setUp, tearDown=testing.tearDown,
151
            optionflags=flags, checker=testing.outputChecker,
152
        ))
153
        for setUp in setups)
154

155
    if ADDING_AVAILABLE:
1!
156
        tests = itertools.chain(tests, ((
×
157
            doctest.DocFileSuite(
158
                '../adding.rst',
159
                setUp=setUp, tearDown=testing.tearDown,
160
                optionflags=flags, checker=testing.outputChecker,
161
            ),)
162
            for setUp in setups))
163

164
    return unittest.TestSuite(itertools.chain(*tests))
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc