Example #1
0
def test_comp_scalar_relative_exception():
    x = 100
    y = 100.01
    unequal = []
    exc = {"var": 1e-3}
    assert comp_scalar("var", y, x, 1e-5, unequal,
                       exceptions=exc, relative=True)
Example #2
0
def test_comp_scalar_failures():
    '''
    Test of failures of utils.comp_scalar() function
    '''
    name = 'Test arrays'
    tol = 1e-5
    a = 1.0
    b = 2.0
    comparison = utils.comp_scalar(name, a, b, tol, [])

    assert not comparison
Example #3
0
def test_comp_scalar_relative_exception():
    x = 100
    y = 100.01
    unequal = []
    exc = {"var": 1e-3}
    assert utils.comp_scalar("var",
                             y,
                             x,
                             1e-5,
                             unequal,
                             exceptions=exc,
                             relative=True)
Example #4
0
def test_comp_scalar(a, b, relative):
    '''
    Test of utils.comp_scalar() function
    '''
    name = 'Test arrays'
    exceptions = {'Test arrays': 1e-6}
    tol = 1e-5
    comparison = utils.comp_scalar(name,
                                   a,
                                   b,
                                   tol, [],
                                   exceptions=exceptions,
                                   relative=relative)

    assert comparison
Example #5
0
def test_comp_scalar_relative():
    x = 100
    y = 100.01
    unequal = []
    assert not utils.comp_scalar("test", y, x, 1e-3, unequal)
    assert utils.comp_scalar("test", y, x, 1e-3, unequal, relative=True)
Example #6
0
def test_comp_scalar_relative():
    x = 100
    y = 100.01
    unequal = []
    assert not comp_scalar("test", y, x, 1e-3, unequal)
    assert comp_scalar("test", y, x, 1e-3, unequal, relative=True)