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