【发布时间】:2022-10-18 18:15:32
【问题描述】:
这就是我编写代码以开始测试的方式单元测试模块,但它返回为 0 个测试。退货有问题吗? (我可以分享完整的代码,但它很长)。在下面发布代码和脚本:
-
脚本:
class Test1(unittest.TestCase): def get_avg(temps, predict_month): #print("Temp:==>>>",temps,"predict_month:=>>>>",predict_month) temp_arr = [] idx_num = month_dict[predict_month] temp_arr.append(float(temps[idx_num])) for i in range (0, 5, 1): idx_num += 1 idx_num = idx_num % 12 temp_arr.append(float(temps[idx_num])) pass # return np.average(temp_arr, axis=0) -
使用 0 个测试显示错误:
Ran 0 tests in 0.000s OK -
我跑了主要单元测试最后是:
if __name__ == '__main__': unittest.main()我想知道我的缺点和漏洞。
【问题讨论】:
标签: python unit-testing testing automated-tests python-unittest