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 ...
随机推荐
- python 列表结构更新的奇妙问题
使用python + plt 画图遇到了一个奇怪的问题 应该出来的是这样: 结果做出来以后是这样: 为什么画到一起了...... 这个锅python列表背 a=[1,2]b=a 这样 改变b ,a ...
- 数组全排列 knuth 分解质因数
template<typename T> void swap(T* a, T* b) { T temp = *a; *a = *b; *b = temp; } //数组的全排列 void ...
- Tyvj3308毒药解药题解
题目大意 这些药都有可能在治愈某些病症的同一时候又使人患上某些别的病症--经过我天才的努力.最终弄清了每种药的详细性能,我会把每种药能治的病症和能使人患上的病症列一张清单给你们,然后你们要依据这张清单 ...
- 判断用户Input输入的事件来进行登陆
我们是通过键盘按的object.keyCode获取的 Html <input onkeydown="keydownMsg(event)" type="text&qu ...
- scheme语言编写执行
scheme是lisp的一种 编辑器能够用emacs.网上有非常多教导怎样编写的 (begin (display "hello") (newline)) 编写完以.scm保存,这里 ...
- PNG24图片兼容IE6解决的方法
非常多人都遇到一个问题:那就是PNG不能正常显示,比方: 网上试过的非常多办法都非常难实现.要嘛就是效果不好,那如今最好的办法就是直接调用JS插件,解决! 点击下载 如今说一下怎么用这个文件吧! 首先 ...
- CrtmpServer 接收推送视频流 注册流基本流程
今天研究了CrtmpServer 将客户端推动过来的视频流注册到服务的流程,记录下来,以备后用. 图1 注册前端视频流流程
- Spring学习【Spring概述】
从本文開始,我们就要一起学习Spring框架,首先不得不说Spring框架是一个优秀的开源框架. 当中採用IoC原理实现的基于Java Beans的配置管理和AOP的思想都是非常值得学习与使用的.以下 ...
- ubuntu + lamp + laravel 环境配置
首先是LAMP 安装顺序是 A(Apache服务器) M(Mysql) P(Php) 安装apache sudo apt-get install apache2 安装mysql sudo apt-g ...
- Spring Boot中使用RSocket
1. 概述 RSocket应用层协议支持 Reactive Streams语义, 例如:用RSocket作为HTTP的一种替代方案.在本教程中, 我们将看到RSocket用在spring boot中, ...