1
这可能是一个愚蠢的问题。Python doctest示例失败
我与蟒蛇文档测试实验,我尝试运行this例如
与
if __name__ == "__main__":
import doctest
doctest.testfile("example.txt")
我已经把“example.txt中”在同一文件夹中包含该示例的源文件结束代码,但我得到了以下错误:
Traceback (most recent call last):
File "test_av_funktioner.py", line 61, in <module>
doctest.testfile("example.txt")
File "C:\Python26\lib\doctest.py", line 1947, in testfile
text, filename = _load_testfile(filename, package, module_relative)
File "C:\Python26\lib\doctest.py", line 219, in _load_testfile
return open(filename).read(), filename
IOError: [Errno 2] No such file or directory: 'example.txt'
我能以某种方式告诉/组,其中文档测试模块搜索指定的文件吗?