本文实例讲述了Python之PyUnit单元测试,与erlang eunit单元测试很像,分享给大家供大家参考。具体方法如下:
1.widget.py文件如下:
复制代码 代码如下:
class Widget:
def init(self, size = (40, 40)):
self.size = size
def getSize(self):
return self.size
def resize(self, width, height):
if width < 0 or height < 0:
raise ValueError, "illegal size"
self.size = (width, height)
def dispose(self):
passDefaultTestCase
Copyright© 2013-2020
All Rights Reserved 京ICP备2023019179号-8