root / JFP / doctest.txt

Revision 112:aa4492e1f366, 492 bytes (checked in by Tarek Ziad?? <tarek@…>, 13 months ago)

fixed apis

Line 
1===============
2doctest example
3===============
4
5You can create documents with code examples. They look like prompt extracts.
6Python provides a module called `doctest` that knows how to extract code
7examples out of a text file, to execute them.
8
9For example, this piece of code::
10
11    >>> 1 + 1
12    2
13
14Can be interpreted by `doctest`, to ensure that the result is 2.
15
16When an example fails, `doctest` raises an assertion error, like
17a classical unit test would do::
18
19    >>> 1 + 1
20    2
21
22
23
Note: See TracBrowser for help on using the browser.