Doctest语法
        
You might have guessed from looking at the previous example: doctest recognizes tests by looking for sections of text that look like they've been copied and pasted from a Python interactive session. Anything that can be expressed in Python is valid within a doctest.        
通过查看之前的例子您可能已经猜到: doctest通过搜寻文本块来识别测试,这些文本看起来像是拷贝粘贴自Python交互会话。  任何能在python中表达的在doctest内都是有效的。

                                                   
Lines that start with a >>> prompt are sent to a Python interpreter. Lines that start with a ... prompt are sent as continuations of the code from the previous line, allowing you to embed complex block statements into your doctests. Finally, any lines that don't start with >>> or ..., up to the next blank line or >>> prompt, represent the output expected from the statement. The output appears as it would in an interactive Python session, including both the return value and the one printed to the console. If you don't have any output lines, doctest assumes it to mean that the statement is expected to have no visible result on the console.
以>>> 提示符开始的行被发送给Python解释器。以...开始的行延续前一行代码发送,允许你将复杂的块语句嵌入到你的doctest。最后,凡是到下一个空 行或者>>>提示符前不以>>>或...开头的行都代表描述语句预期的输出。这个输出就好像是在一个交互的 python会话中产生的,其中包括返回值以及打印到控制台上的输出。如果您没有任何输出行,那么doctest理解的含义是该语句将不会在控制台上有可 见的结果输出。
**assume, suggest 等词通常翻译成认为或理解。**
                                                   
Doctest ignores anything in the file that isn't part of a test, which means that you can place explanatory text, HTML, line-art diagrams, or whatever else strikes your fancy in between your tests. We took advantage of that in the previous doctest, to add an explanatory sentence before the test itself.
Doctest忽略任何文件中与测试无关的部分,也就是说你能放置说明性的文本,HTML, 线条图表,    或任何其它测视里你喜欢添加的内容。 在之前的doctest里我们可利用这一特点在测试前添加一个说明性文字。