随笔分类 -  单元测试

摘要:1.使用unittest来开发python测试 PyUnit创建于1999,2001年被加入到python2.1的基础类库中。名字叫unittest。例子1:#first democlass MyClass(object): def __init__(self,num): sel... 阅读全文
posted @ 2012-12-07 12:06 jianhong 阅读(321) 评论(0) 推荐(0) 编辑
摘要:1.使用unittest来开发python测试 PyUnit创建于1999,2001年被加入到python2.1的基础类库中。名字叫unittest。例子1:#first democlass MyClass(object): def __init__(self,num): sel... 阅读全文
posted @ 2012-12-07 12:06 jianhong 阅读(1138) 评论(0) 推荐(0) 编辑
摘要:monkey patch (猴子补丁) 用来在运行时动态修改已有的代码,而不需要修改原始代码。简单的monkey patch 实现:#coding=utf-8def originalFunc(): print 'this is original function!' def modifi... 阅读全文
posted @ 2012-11-27 12:10 jianhong 阅读(592) 评论(0) 推荐(0) 编辑
摘要:monkey patch (猴子补丁) 用来在运行时动态修改已有的代码,而不需要修改原始代码。简单的monkey patch 实现:#coding=utf-8def originalFunc(): print 'this is original function!' def modifi... 阅读全文
posted @ 2012-11-27 12:10 jianhong 阅读(1965) 评论(0) 推荐(0) 编辑
摘要:一、安装nose 先用easy_install 安装 nose,easy_install是一个很好的python工具,可以方便安装很多的python程序。可以去http://pypi.python.org/pypi/setuptools了解一下easy_install。如果懒得去看的,可以直接从这... 阅读全文
posted @ 2012-11-02 16:42 jianhong 阅读(265) 评论(0) 推荐(0) 编辑
摘要:一、安装nose 先用easy_install 安装 nose,easy_install是一个很好的python工具,可以方便安装很多的python程序。可以去http://pypi.python.org/pypi/setuptools了解一下easy_install。如果懒得去看的,可以直接从这... 阅读全文
posted @ 2012-11-02 16:42 jianhong 阅读(592) 评论(0) 推荐(0) 编辑
摘要:现在的软件开发过程中,测试往往关系到一个项目的成败。所以,我们非常有必要学习如何测试自己所编写的代码。那么,python能够在这方面做些什么呢? 首先,我们编写一个自己的类文件。 例1. widget.pyclass Widget: def __init__(self,size=(40,40... 阅读全文
posted @ 2012-04-01 10:39 jianhong 阅读(238) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示