Debian Codegraph @

Lib/test/test_doctest/sample_doctest_errors.py

raw
1 """This is a sample module used for testing doctest.
2
3 This module includes various scenarios involving errors.
4
5 >>> 2 + 2
6 5
7 >>> 1/0
8 1
9 """
10
11 def g():
12 [][0] # line 12
13
14 def errors():
15 """
16 >>> 2 + 2
17 5
18 >>> 1/0
19 1
20 >>> def f():
21 ... 2 + '2'
22 ...
23 >>> f()
24 1
25 >>> g()
26 1
27 """
28
29 def syntax_error():
30 """
31 >>> 2+*3
32 5
33 """
34
35 __test__ = {
36 'bad': """
37 >>> 2 + 2
38 5
39 >>> 1/0
40 1
41 """,
42 }
43
44 def test_suite():
45 import doctest
46 return doctest.DocTestSuite()