作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
每当我尝试在 python 中进行 doctest 时,基本上每当我运行代码时
if __name__ =="__main__":
import doctest
doctest.testmod()
我从口译员那里得到了这个回应
AttributeError: 'module' 对象没有属性 'testmod'
我可以很好地运行这段代码,但是每当我在我的 Windows 机器上运行它时,它就无法运行。
我的机器运行的是 Windows 他们的是 OS X,但运行的是 python 2.7.5。
谢谢你:)
最佳答案
确保您没有尝试将测试文件保存为 doctest.py
。上面建议的打印语句将显示它。如果文件名为doctest.py
,则重命名并重试。
关于windows - 属性错误 : 'module' object has no attribute 'testmod' Python doctest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29089174/
我正在尝试跨多个模块进行自动化测试。所有这些模块都有一个带有单元测试的“test()”函数。一些模块是基本的,它们的测试包含简单的语句,但大多数模块都有 unittest 或 doctest。我在动态
每当我尝试在 python 中进行 doctest 时,基本上每当我运行代码时 if __name__ =="__main__": import doctest doctest.testm
我在使用 magento 中的 authorised.net 方法进行排序时遇到错误: "Gateway error: (TESTMODE) The merchant login ID or pass
我是一名优秀的程序员,十分优秀!