Debian Codegraph @

IPython/testing/plugin/simple.py

raw
1 """Simple example using doctests.
2
3 This file just contains doctests both using plain python and IPython prompts.
4 All tests should be loaded by Pytest.
5 """
6
7
8 def pyfunc():
9 """Some pure python tests...
10
11 >>> pyfunc()
12 'pyfunc'
13
14 >>> import os
15
16 >>> 2+3
17 5
18
19 >>> for i in range(3):
20 ... print(i, end=' ')
21 ... print(i+1, end=' ')
22 ...
23 0 1 1 2 2 3
24 """
25 return "pyfunc"
26
27
28 def ipyfunc():
29 """Some IPython tests...
30
31 In [1]: ipyfunc()
32 Out[1]: 'ipyfunc'
33
34 In [2]: import os
35
36 In [3]: 2+3
37 Out[3]: 5
38
39 In [4]: for i in range(3):
40 ...: print(i, end=' ')
41 ...: print(i+1, end=' ')
42 ...:
43 Out[4]: 0 1 1 2 2 3
44 """
45 return "ipyfunc"