예제 #1
0
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))
예제 #2
0
    def test_mean_incorrect(self):
        array1 = Array((3, ), 1.0, 2.0, 3.0)
        result = array1.mean()

        assert result != 1
예제 #3
0
    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
예제 #4
0
    def test_mean_correct(self):
        array1 = Array((4, ), 1, 2, 3, 2)
        result = array1.mean()

        assert result == 2.0