Exemplo n.º 1
0
def test_SS_fsolve(guesses, args, expected):
    '''
    Test SS.SS_fsolve function.  Provide inputs to function and
    ensure that output returned matches what it has been before.
    '''
    test_list = SS.SS_fsolve(guesses, *args)
    assert (np.allclose(np.array(test_list), np.array(expected), atol=1e-6))
Exemplo n.º 2
0
def test_SS_fsolve():
    # Test SS.SS_fsolve function.  Provide inputs to function and
    # ensure that output returned matches what it has been before.
    input_tuple = utils.safe_read_pickle(
        os.path.join(CUR_PATH, 'test_io_data/SS_fsolve_inputs.pkl'))
    guesses, params = input_tuple
    params = params + (None, 1)
    (bssmat, nssmat, chi_params, ss_params, income_tax_params,
     iterative_params, small_open_params, client, num_workers) = params
    income_tax_params = ('DEP', ) + income_tax_params
    params = (bssmat, nssmat, chi_params, ss_params, income_tax_params,
              iterative_params, small_open_params, client, num_workers)
    test_list = SS.SS_fsolve(guesses, params)

    expected_list = utils.safe_read_pickle(
        os.path.join(CUR_PATH, 'test_io_data/SS_fsolve_outputs.pkl'))
    print('outputs = ',
          np.absolute(np.array(test_list) - np.array(expected_list)).max())
    assert (np.allclose(np.array(test_list), np.array(expected_list)))