ยปCore Development>Code coverage>Lib/test/sample_doctest.py

Python code coverage for Lib/test/sample_doctest.py

#countcontent
1n/a"""This is a sample module that doesn't really test anything all that
2n/a interesting.
3n/a
4n/aIt simply has a few tests, some of which succeed and some of which fail.
5n/a
6n/aIt's important that the numbers remain constant as another test is
7n/atesting the running of these tests.
8n/a
9n/a
10n/a>>> 2+2
11n/a4
12n/a"""
13n/a
14n/a
15n/adef foo():
16n/a """
17n/a
18n/a >>> 2+2
19n/a 5
20n/a
21n/a >>> 2+2
22n/a 4
23n/a """
24n/a
25n/adef bar():
26n/a """
27n/a
28n/a >>> 2+2
29n/a 4
30n/a """
31n/a
32n/adef test_silly_setup():
33n/a """
34n/a
35n/a >>> import test.test_doctest
36n/a >>> test.test_doctest.sillySetup
37n/a True
38n/a """
39n/a
40n/adef w_blank():
41n/a """
42n/a >>> if 1:
43n/a ... print('a')
44n/a ... print()
45n/a ... print('b')
46n/a a
47n/a <BLANKLINE>
48n/a b
49n/a """
50n/a
51n/ax = 1
52n/adef x_is_one():
53n/a """
54n/a >>> x
55n/a 1
56n/a """
57n/a
58n/adef y_is_one():
59n/a """
60n/a >>> y
61n/a 1
62n/a """
63n/a
64n/a__test__ = {'good': """
65n/a >>> 42
66n/a 42
67n/a """,
68n/a 'bad': """
69n/a >>> 42
70n/a 666
71n/a """,
72n/a }
73n/a
74n/adef test_suite():
75n/a import doctest
76n/a return doctest.DocTestSuite()