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