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