Esempio n. 1
0
def test_get_coarse_values_gci_error(mocker):

    mocker.patch('convergence.interface.gci',
                 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]["gci_f"] is None
Esempio n. 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