def test_average2(self): linq = Linq([1.0, 1.0, 4.0, 2.0, 2.0]) ave = linq.average(select_f=lambda x: x * x) assert_true(5.2 - 0.0002 < ave and ave < 5.2 + 0.0002)
def test_average3(self): linq = Linq([]) linq.average()
def test_average(self): linq = Linq([1.0, 1.0, 4.0, 2.0, 2.0]) ave = linq.average() assert_true(2 - 0.0002 < ave and ave < 2 + 0.0002)