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 ...
随机推荐
- Controller 层实现
一.实验介绍 1.1 实验内容 本节课程主要利用 Spring MVC 框架实现 Controller 层以及一些辅助类的实现. 1.2 实验知识点 Spring MVC 框架 1.3 实验环境 JD ...
- NN优化方法对照:梯度下降、随机梯度下降和批量梯度下降
1.前言 这几种方法呢都是在求最优解中常常出现的方法,主要是应用迭代的思想来逼近.在梯度下降算法中.都是环绕下面这个式子展开: 当中在上面的式子中hθ(x)代表.输入为x的时候的其当时θ參数下的输出值 ...
- mt-datetime-picker type="date" 时间格式 bug
1.mint-ui 中 mt-datetime-picker 组件,存在日期格式 bug <!-- 日期选择器 --> <template> <div class=&qu ...
- pascals-triangleI、II——生成规律的三角形
1.Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Ret ...
- C语言变长数组 struct中char data[0]的用法
版权声明:本文为博主原创文章,未经博主允许不得转载. 今天在看一段代码时出现了用结构体实现变长数组的写法,一开始因为忘记了这种技术,所以老觉得作者的源码有误,最后经过我深思之后,终于想起以前看过的用s ...
- 前言(CSDN也有Markdown了,好开森)
实战出精华 在具体的C++网络编程中提升你的逼格 John Torjo Boost.Asio C++ 网络编程 Copyright © 2013 Packt Publishing 关于作者 做为一名权 ...
- 轻松搞定RabbitMQ(四)——发布/订阅
转自 http://blog.csdn.net/xiaoxian8023/article/details/48729479 翻译地址:http://www.rabbitmq.com/tutorials ...
- 自己动手写CPU之第七阶段(5)——流水线暂停机制的设计与实现
将陆续上传本人写的新书<自己动手写CPU>,今天是第28篇.我尽量每周四篇 China-pub的预售地址例如以下(有文件夹.内容简单介绍.前言): http://product.china ...
- 增加录像时间戳水印、 camera框架介绍
http://blog.csdn.net/mirkerson/article/details/38920107 http://blog.csdn.net/jimbo_lee/article/detai ...
- Ubuntu16.04下自定义命令
每次启动pycharm的时候需要敲一段很长的文本,真的是感觉好麻烦啊,如果能直接敲命令启动就好了,既装B又实用的 那么到底应该怎么做呢?其实挺简单的 在文件/root/.bashrc 中添加下边的几行 ...