def test_mean(arg, np_arg): """ Verify that mean of array values is correct """ my_arr = Array(arg[0], *arg[1]) np_arr = np.array(np_arg) assert my_arr.mean() == pytest.approx(np.mean(np_arr))
def test_mean_incorrect(self): array1 = Array((3, ), 1.0, 2.0, 3.0) result = array1.mean() assert result != 1
def test_mean_2D_correct(self): array1 = Array((2, 3), 1, 2, 3, 4, 5, 6) result = array1.mean() expected = sum([1, 2, 3, 4, 5, 6]) / 6 assert result == expected
def test_mean_correct(self): array1 = Array((4, ), 1, 2, 3, 2) result = array1.mean() assert result == 2.0