Example #1
0
def test_get_shared_order_of_convergence_error(mocker):

    mocker.patch('convergence.interface.order_of_convergence',
                 side_effect=ArithmeticError("mock"))

    in_path = os.path.join(DATA_DIR_PATH, "prD.do")
    main_list = simple_read(in_path)
    convergence = Convergence(f_anal=0.9713)
    convergence._set_grids(main_list)
    convergence._set_grid_triplets()

    with pytest.warns(UserWarning):
        convergence._get_shared()

    assert convergence._grid_shared[0]["p"] is None
Example #2
0
def test_get_ratios_error(mocker, test_input):

    mocker.patch(test_input, side_effect=ArithmeticError("mock"))

    in_path = os.path.join(DATA_DIR_PATH, "prD.do")
    main_list = simple_read(in_path)
    convergence = Convergence(f_anal=0.9713)
    convergence._set_grids(main_list)
    convergence._set_grid_triplets()
    convergence._get_shared()

    with pytest.warns(UserWarning):
        convergence._get_fine_values()
        convergence._get_coarse_values()
        convergence._get_ratios()

    assert convergence._grid_ratios[0]['assym_ratio'] is None
Example #3
0
def test_get_coarse_values_richardson_extrapolate_error(mocker):

    mocker.patch('convergence.interface.richardson_extrapolate',
                 side_effect=ArithmeticError("mock"))

    in_path = os.path.join(DATA_DIR_PATH, "prD.do")
    main_list = simple_read(in_path)
    convergence = Convergence(f_anal=0.9713)
    convergence._set_grids(main_list)
    convergence._set_grid_triplets()
    convergence._get_shared()

    with pytest.warns(UserWarning):
        convergence._get_coarse_values()

    assert convergence._grid_coarse[0]["f_exact"] is None
    assert convergence._grid_coarse[0]["f_delta"] is None
Example #4
0
def test_get_fine_values_error_estimates_error(mocker):

    mocker.patch('convergence.interface.error_estimates',
                 side_effect=ArithmeticError("mock"))

    in_path = os.path.join(DATA_DIR_PATH, "prD.do")
    main_list = simple_read(in_path)
    convergence = Convergence(f_anal=0.9713)
    convergence._set_grids(main_list)
    convergence._set_grid_triplets()
    convergence._get_shared()

    with pytest.warns(UserWarning):
        convergence._get_fine_values()

    assert convergence._grid_fine[0]["e_a"] is None
    assert convergence._grid_fine[0]["e_anal"] is None