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