It's our wits that make us men.

Python测试用例方案

Posted on By ZY
个人分类:Python

执行代码

"""
Filename: solution.py 
Created on Thu Mar 28 11:06:08 CST 2019
测试用例
"""
 
class Solution1:
    def reverse(self, x: int) -> int:
        # 算法写在这里
        ret = 0
 
        return ret
 
 
#===============================================================================
# Test 针对不同项目修改不同的test案例
#===============================================================================
test = {
    123: 321,
    -123: -321,
    120: 21,
    0: 0,
    -100: -1,
    1534236469: 0,
 
}
 
sol = Solution1()
for k, v in test.items():
    res = sol.reverse(k)
 
    print('-'*80)
    print('Input:', k)
    print('Correct:', v)
    print('Output:', res)
    if res == v: print('Passed.')
    else: print('Wrong!!')