Beispiel #1
0
 def test_div2(self):
     print("测试两个浮点型数据div")
     d2 = Count(245.45, 34.67)
     res2 = d2.div()
     print("实际计算结果:", res2)
     if abs(res2 - 7.0796) < 0.01:
         res2 = 7.0796
     self.assertEqual(res2, 7.0796)
Beispiel #2
0
 def test_div1(self):
     print("使用多组数据测试两个整数div")
     i = 0
     for x, y in zip(list1_zhengshu, list2_zhengshu):
         d1 = Count(y,x)
         res_zhengshu[i] = d1.div()
         print("计算实际结果:", res_zhengshu[i])
         i = i + 1
     for res, res_right in zip(res_zhengshu, res_zhengshuRight):
         self.assertEqual(res, res_right)
Beispiel #3
0
 def test_div2(self):
     print("使用多组数据测试两个浮点型数据div")
     i = 0
     for x, y in zip(list1_fudianshu, list2_fudianshu):
         d2 = Count(y, x)
         res_fudianshu[i] = d2.div()
         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)
Beispiel #4
0
    def test_div1(self):
        print("使用多组数据测试两个整数div1")
        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]):
            d1 = Count(int(x), int(y))
            zhengshuData[2][i] = d1.div()
            print("计算实际结果:", zhengshuData[2][i])
            i = i + 1

        i = 0
        for item in zhengshuData[6]:
            zhengshuData[6][i] = float(item)
            i = i + 1

        for res, res_right in zip(zhengshuData[2], zhengshuData[6]):
            self.assertEqual(res, res_right)
Beispiel #5
0
    def test_div2(self):
        print("使用多组数据测试两个浮点型数据div2")
        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]):
            d2 = Count(float(x), float(y))
            fudianshuData[2][i] = d2.div()
            print("计算实际结果:", fudianshuData[2][i])
            i = i + 1

        i = 0
        for item in fudianshuData[6]:
            fudianshuData[6][i] = float(item)
            i = i + 1

        for res, res_right in zip(fudianshuData[2], fudianshuData[6]):
            if abs(res - res_right) < 0.001:
                res = res_right
            self.assertEqual(res, res_right)
Beispiel #6
0
 def test_div1(self):
     print("测试两个整数div")
     d1 = Count(100, 20)
     res1 = d1.div()
     print("实际计算结果:", res1)
     self.assertEqual(res1, 5)