Esempio n. 1
0
def test_comp_array_relative_exception():
    x = np.array([100., 200., 300.])
    y = np.array([100.01, 200.02, 300.03])
    unequal = []
    exc = {'var': 1e-3}
    assert comp_array("var", y, x, 1e-5, unequal,
                      exceptions=exc, relative=True)
Esempio n. 2
0
def test_comp_array_failures(a, b):
    '''
    Test of failures of utils.comp_array() function
    '''
    name = 'Test arrays'
    tol = 1e-5
    comparison = utils.comp_array(name, a, b, tol, [])

    assert not comparison
Esempio n. 3
0
def test_comp_array_relative_exception():
    x = np.array([100., 200., 300.])
    y = np.array([100.01, 200.02, 300.03])
    unequal = []
    exc = {'var': 1e-3}
    assert utils.comp_array("var",
                            y,
                            x,
                            1e-5,
                            unequal,
                            exceptions=exc,
                            relative=True)
Esempio n. 4
0
def test_comp_array(a, b, relative):
    '''
    Test of utils.comp_array() function
    '''
    name = 'Test arrays'
    exceptions = {'Test arrays': 1e-6}
    tol = 1e-5
    comparison = utils.comp_array(name,
                                  a,
                                  b,
                                  tol, [],
                                  exceptions=exceptions,
                                  relative=relative)

    assert comparison
Esempio n. 5
0
def test_comp_array_relative():
    x = np.array([100., 200., 300.])
    y = np.array([100.01, 200.02, 300.03])
    unequal = []
    assert not utils.comp_array("test", y, x, 1e-3, unequal)
    assert utils.comp_array("test", y, x, 1e-3, unequal, relative=True)
Esempio n. 6
0
def test_comp_array_relative():
    x = np.array([100., 200., 300.])
    y = np.array([100.01, 200.02, 300.03])
    unequal = []
    assert not comp_array("test", y, x, 1e-3, unequal)
    assert comp_array("test", y, x, 1e-3, unequal, relative=True)