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)
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
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)
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
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)
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)