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的更多相关文章

  1. A/B Testing的简要知识

    A/B testing主要用来检测网站或者APP的两个版本中哪一个更好,它的中心思想是把流量一分为二,一份用作experiment group,访问新的版本,另一份用作control group,访问 ...

  2. Building the Testing Pipeline

    This essay is a part of my knowledge sharing session slides which are shared for development and qua ...

  3. Monkey Patch/Monkey Testing/Duck Typing/Duck Test

    Monkey Patch Monkey Testing Duck Typing Duck Test

  4. 让产品有效迭代,前端A/B Testing的简单实现

    A/B Testing简介 互联网产品的迭代速度很快,往往一周一小发布,一月一大发布,产品提出的种种需求,哪些改动是提升产品体验的,哪些是阻碍产品进步的,如果没有数据可以参考,仅仅是靠拍脑袋的话,对产 ...

  5. Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques

    Web Application Penetration Testing Local File Inclusion (LFI) Testing Techniques Jan 04, 2017, Vers ...

  6. Unit Testing with NSubstitute

    These are the contents of my training session about unit testing, and also have some introductions a ...

  7. 模糊测试(fuzz testing)介绍(一)

    模糊测试(fuzz testing)是一类安全性测试的方法.说起安全性测试,大部分人头脑中浮现出的可能是一个标准的“黑客”场景:某个不修边幅.脸色苍白的年轻人,坐在黑暗的房间中,正在熟练地使用各种工具 ...

  8. QA is more than Testing

    前话:在测试这个行业做了挺多年了,都快忘记自己大学的专业是国际经济与贸易,一个选择可能就决定了一生的方向. 但既然做了选择,就走下去. ----------------- 在这么多年的工作中,测试始终 ...

  9. Testing with a mocking framework (EF6 onwards)

    When writing tests for your application it is often desirable to avoid hitting the database.  Entity ...

  10. 【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 ...

随机推荐

  1. java单测时的等待模块awaitility

    单测时,可以用来等待异步任务完成 在编写自动化测试用例过程中,往往会遇见被测代码有异步或者队列处理的中间过程:如果需要校验这部分结果,必须等待异步操作结束或队列消费完,而这个中间等待的时间是不确定的, ...

  2. lfu-cache(需要O(1),所以挺难的)

    https://leetcode.com/problems/lfu-cache/ 很难,看了下面的参考: https://discuss.leetcode.com/topic/69137/java-o ...

  3. 编译php ./configure命令enable和with有什么区别

    原文: https://segmentfault.com/q/1010000009174725 ---------------------------------------------------- ...

  4. C 标准库 - <stdarg.h>

    C 标准库 - <stdarg.h> 简介 stdarg.h 头文件定义了一个变量类型 va_list 和三个宏,这三个宏可用于在参数个数未知(即参数个数可变)时获取函数中的参数. 可变参 ...

  5. log4j:WARN Please initialize the log4j system properly解决的方法

    要解决问题很easy,建立LOG4J 的配置文件就可以. 在src 文件夹下创建配置文件,选 一.择菜单File > New > File,文件名称输入log4j.properties,文 ...

  6. powerDesignner连接数据库

    http://hi.baidu.com/huntererpang/item/e65e1c48aa0ab50a6dc2f090 选用microsoft odbc for oracle 数据源名称:我喜欢 ...

  7. 如何把网页或html内容生成图片

    网页或html内容生成图片 今天想把做好的html内容或网页生成一张图片,没有网页在线版的生成或转换工具,除非下载客户端软件使用.   不过,发现可以利用搜狗高速浏览器和360浏览器生成图片,这里讲解 ...

  8. fuser - identify processes using files or sockets

    FUSER(1) User Commands FUSER(1) NAME fuser - identify processes using files or sockets SYNOPSIS fuse ...

  9. GoogleFusionTablesAPI初探地图与云计算

    http://developer.51cto.com/art/200906/129324.htm http://yexiaochai.iteye.com/blog/1893735 http://yex ...

  10. caffe搭建--caffe- win10 vs2015 编译(支持GPU)--注意在cmake的时候需要根据情况仔细修改配置

    --http://blog.csdn.net/longji/article/details/60964998 注意: 在cmake的时候需要根据情况仔细修改配置,比如,如果gpu的能力不足3.0的话, ...