16.2.7.2 由文件运行
testfile()的做法类似于testmod(),允许在测试程序中从一个外部文件显式调用测试。
import doctest
if __name__ == '__main__':
doctest.testfile('doctest_in_help.txt')
testmod()和testfile()包括一些可选的参数,能通过doctest选项控制测试的行为。关于这些特性的更多详细信息可以参考标准库文档——不过要注意,大多数情况下并不需要这些特性。