testing
doctest_test.py
def square(x):
'''
这里需要空格
>>> square(2)
4 啦啦
>>> square(3)
9 上不一行能添加其他字符串
'''
return x*x
if __name__=='__main__':
import doctest,doctest_test
doctest.testmod(doctest_test)
'''
python doctest_test.py
python doctest_test.py -v
'''
unittest_test.py
import unittest,unittest_test
def product(x,y):
return x*y class ProductTest(unittest.TestCase):
def testInte(self):
for x in range(-10,10):
for y in range(-10,10):
p=unittest_test.product(x,y)
self.failUnless(p==x*y,'int failed')
def testFloat(self):
for x in range(-10, 10):
for y in range(-10, 10):
x=x/10
y=y/10
p = unittest_test.product(x, y)
self.failUnless(p == x * y, 'float failed')
if __name__=='__main__':
unittest.main()
testing的更多相关文章
- A/B Testing的简要知识
A/B testing主要用来检测网站或者APP的两个版本中哪一个更好,它的中心思想是把流量一分为二,一份用作experiment group,访问新的版本,另一份用作control group,访问 ...
- Building the Testing Pipeline
This essay is a part of my knowledge sharing session slides which are shared for development and qua ...
- Monkey Patch/Monkey Testing/Duck Typing/Duck Test
Monkey Patch Monkey Testing Duck Typing Duck Test
- 让产品有效迭代,前端A/B Testing的简单实现
A/B Testing简介 互联网产品的迭代速度很快,往往一周一小发布,一月一大发布,产品提出的种种需求,哪些改动是提升产品体验的,哪些是阻碍产品进步的,如果没有数据可以参考,仅仅是靠拍脑袋的话,对产 ...
- Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques
Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques Jan 04, 2017, Vers ...
- Unit Testing with NSubstitute
These are the contents of my training session about unit testing, and also have some introductions a ...
- 模糊测试(fuzz testing)介绍(一)
模糊测试(fuzz testing)是一类安全性测试的方法.说起安全性测试,大部分人头脑中浮现出的可能是一个标准的“黑客”场景:某个不修边幅.脸色苍白的年轻人,坐在黑暗的房间中,正在熟练地使用各种工具 ...
- QA is more than Testing
前话:在测试这个行业做了挺多年了,都快忘记自己大学的专业是国际经济与贸易,一个选择可能就决定了一生的方向. 但既然做了选择,就走下去. ----------------- 在这么多年的工作中,测试始终 ...
- Testing with a mocking framework (EF6 onwards)
When writing tests for your application it is often desirable to avoid hitting the database. Entity ...
- 【Python + Selenium】Mock Testing 是啥?一个so上的高票答案。
There are many kinds of testing which really made me confused. To be honest, I've never heard of som ...
随机推荐
- Android -- AsyncTask 使用和缺陷
一.AsyncTask的基本用法 由于AsyncTask是一个抽象类,所以如果我们想使用它,就必须要创建一个子类去继承它.在继承时我们可以为AsyncTask类指定三个泛型参数,这三个参数的用途如下: ...
- jquery怎么找到元素下面的第一个子元素
<ul><li>11</li><li>22</li><li>33</li><li>44</li&g ...
- SQL中Inserted 和Deleted表 以及触发Trigger
什么是Inserted 和Deleted表 他们有什么用 trigger 的简单实用 1.什么是Inserted 和Deleted表 当插入数据的时候,其实是同时向目的表 和inserted表中插入数 ...
- redis 在我做的容器中的配置路劲
配置 /etc/redis/redis.conf 数据库位置 /var/lib/redis/dump.rdb
- Unity3D游戏开发之简单的碰撞检測
在"Project"面板中单击"Create"旁边的小三角,选择"javascript"创建一个名为"collision" ...
- redirect_uri 參数错误的解决的方法
我通过java代码去获得用户的openid,一直报redirect_uri. 我页面代码的链接为: https://open.weixin.qq.com/connect/oauth2/authoriz ...
- Android 设计模式之单例模式
设计模式是前人在开发过程中总结的一些经验,我们在开发过程中依据实际的情况,套用合适的设计模式,能够使程序结构更加简单.利于程序的扩展和维护.但也不是没有使用设计模式的程序就不好.如简单的程序就不用了, ...
- 高性能MySQL(三)
服务器性能剖析 性能优化概述 性能优化是降低CPU使用率?错误,资源就是用来消耗的,新版本MySQL的InnoDB引擎对资源的利用率还增高了,所以这不是一个好的衡量标准. 提升每秒查询量?其实就是吞吐 ...
- iOS开发者必备:四款后端服务工具
本文转载至 http://mobile.51cto.com/iphone-411917.htm 对于开发者来说,连接后端数据或许是一件特别痛苦的事情.但后端服务却能够帮助开发人员以更快的速度构建移动应 ...
- 开源G711(PCMA、PCMU)/G726转AAC项目EasyAACEncoder
EasyDarwin开源社区整理了一份G711(PCMA.PCMU)/G726转AAC的转码库,支持Windows/Linux跨平台使用,将安防标准的G711转成移动互联网常用的AAC格式,希望能给大 ...