from calculator import Count
#测试两个整数相加
class TestCount:
def test_add(self):
try:
c=Count(2,4)
result=c.add()
assert(result ==6),'Integer addition result error!'
except AssertionError as msg:
print(msg)
else:
print('test pass!')
# 执行测试类的测试方法
test =TestCount()
test.test_add()
结果:test pass!