Show More
@@ -1,30 +1,30 b'' | |||
|
1 | 1 | ================================= |
|
2 | 2 | Tests in example form - IPython |
|
3 | 3 | ================================= |
|
4 | 4 | |
|
5 | 5 | You can write text files with examples that use IPython prompts (as long as you |
|
6 | 6 | use the nose ipython doctest plugin), but you can not mix and match prompt |
|
7 | 7 | styles in a single file. That is, you either use all ``>>>`` prompts or all |
|
8 | 8 | IPython-style prompts. Your test suite *can* have both types, you just need to |
|
9 | 9 | put each type of example in a separate. Using IPython prompts, you can paste |
|
10 | 10 | directly from your session:: |
|
11 | 11 | |
|
12 | 12 | In [5]: s="Hello World" |
|
13 | 13 | |
|
14 | 14 | In [6]: s.upper() |
|
15 | 15 | Out[6]: 'HELLO WORLD' |
|
16 | 16 | |
|
17 | 17 | Another example:: |
|
18 | 18 | |
|
19 | 19 | In [8]: 1+3 |
|
20 | 20 | Out[8]: 4 |
|
21 | 21 | |
|
22 | 22 | Just like in IPython docstrings, you can use all IPython syntax and features:: |
|
23 | 23 | |
|
24 |
In [9]: !echo |
|
|
24 | In [9]: !echo hello | |
|
25 | 25 | hello |
|
26 | 26 | |
|
27 | 27 | In [10]: a='hi' |
|
28 | 28 | |
|
29 | 29 | In [11]: !echo $a |
|
30 | 30 | hi |
General Comments 0
You need to be logged in to leave comments.
Login now