def test_mul2(self): print("测试两个浮点型数据mul") m2 = Count(20.45, 45.67) res2 = m2.mul() print("实际计算结果:", res2) if abs(res2 - 933.9515) < 0.01: res2 = 933.9515 self.assertEqual(res2, 933.9515)
def test_mul1(self): print("使用多组数据测试两个整数mul") i = 0 for x, y in zip(list1_zhengshu, list2_zhengshu): m1 = Count(x, y) res_zhengshu[i] = m1.mul() print("计算实际结果:", res_zhengshu[i]) i = i + 1 for res, res_right in zip(res_zhengshu, res_zhengshuRight): self.assertEqual(res, res_right)
def test_mul2(self): print("使用多组数据测试两个浮点型数据mul") i = 0 for x, y in zip(list1_fudianshu, list2_fudianshu): m2 = Count(x, y) res_fudianshu[i] = m2.mul() print("计算实际结果:", res_fudianshu[i]) i = i + 1 for res, res_right in zip(res_fudianshu, res_fudianshuRight): if abs(res - res_right) < 0.001: res = res_right self.assertEqual(res, res_right)
def test_mul1(self): print("使用多组数据测试两个整数mul") print("开始获取测试数据:") getdata = GetTestData() file = getdata.openDataFile( "E:/Python/demo/csv/importData/zhengshuData.csv") zhengshuData = getdata.getData(file) i = 0 for x, y in zip(zhengshuData[1], zhengshuData[0]): m1 = Count(int(x), int(y)) zhengshuData[2][i] = m1.mul() print("计算实际结果:", zhengshuData[2][i]) i = i + 1 i = 0 for item in zhengshuData[5]: zhengshuData[5][i] = float(item) i = i + 1 for res, res_right in zip(zhengshuData[2], zhengshuData[5]): self.assertEqual(res, res_right)
def test_mul2(self): print("使用多组数据测试两个浮点型数据mul") print("开始获取测试数据:") getdata = GetTestData() file = getdata.openDataFile( 'E:/Python/demo/csv/importData/fudianshuData.csv') fudianshuData = getdata.getData(file) i = 0 for x, y in zip(fudianshuData[1], fudianshuData[0]): m2 = Count(float(x), float(y)) fudianshuData[2][i] = m2.mul() print("计算实际结果:", fudianshuData[2][i]) i = i + 1 i = 0 for item in fudianshuData[5]: fudianshuData[5][i] = float(item) i = i + 1 for res, res_right in zip(fudianshuData[2], fudianshuData[5]): if abs(res - res_right) < 0.001: res = res_right self.assertEqual(res, res_right)
def test_mul1(self): print("测试两个整数mul") m1 = Count(10, 20) res1 = m1.mul() print("实际计算结果:", res1) self.assertEqual(res1, 200)