def test_econ(delta, bonus, r, pi, expected_val):
    test_val = cf.econ(delta, bonus, r, pi)

    assert (np.allclose(test_val, expected_val))
Beispiel #2
0
def test_econ(delta, bonus, r, pi, expected_val):
    test_val = cf.econ(delta, bonus, r, pi)

    assert(np.allclose(test_val, expected_val))
@pytest.mark.parametrize('rho,delta,expected_val', test_data, ids=['Test 0'])
def test_eq_ucc(rho, delta, expected_val):
    test_val = cf.eq_ucc(rho, delta)

    assert (np.allclose(test_val, expected_val))


rho = np.array([0.075285714, 0.0388, 0.042, 0.0112, 0.114475829, 0.094])
r_prime = np.array([0.05, 0.06, 0.04, 0.03, 0.11, 0.12])
pi = 0.02
expected_val = np.array([
    0.601518027, -0.030927835, 0.523809524, 0.107142857, 0.213807831,
    -0.063829787
])
z2 = cf.econ(0.05, 0.0, 0.04, 0.02)
rho2 = cf.eq_coc(0.05, z2, 0.0, 0.35, 0.0, 0.02, 0.04)
expected_val2 = 0.35
rho3 = cf.eq_coc(0.05, 1.0, 0.0, 0.35, 0.0, 0.02, 0.04)
test_data = [(rho, r_prime, pi, expected_val),
             (rho2, 0.04, 0.02, expected_val2), (rho3, 0.04, 0.02, 0.0)]


@pytest.mark.parametrize(
    'rho,r_prime,pi,expected_val',
    test_data,
    ids=['Test: vector', 'Test: statutory', 'Test: 0 rate'])
def test_eq_metr(rho, r_prime, pi, expected_val):
    test_val = cf.eq_metr(rho, r_prime, pi)

    assert (np.allclose(test_val, expected_val))