예제 #1
0
def test_simple_eval():
    specs = Specifications()
    specs.T = 100
    assert specs.simple_eval('T / 2') == 50
    assert specs.simple_eval('T * 2') == 200
    assert specs.simple_eval('T - 2') == 98
    assert specs.simple_eval('T + 2') == 102
예제 #2
0
def test_get_biz_tax():
    # Test function for business tax receipts
    p = Specifications()
    new_param_values = {
        'tau_b': [0.20],
        'delta_tau_annual': [0.06]
    }
    p.update_specifications(new_param_values)
    p.T = 3
    w = np.array([1.2, 1.1, 1.2])
    Y = np.array([3.0, 7.0, 3.0])
    L = np.array([2.0, 3.0, 2.0])
    K = np.array([5.0, 6.0, 5.0])
    biz_tax = tax.get_biz_tax(w, Y, L, K, p, 'TPI')
    assert np.allclose(biz_tax, np.array([0.06, 0.668, 0.06]))
예제 #3
0
p = Specifications()
p.tax_func_type = 'DEP'
p.J = 1
p.S = 3
p.lambdas = np.array([1.0])
p.e = np.array([0.5, 0.45, 0.3]).reshape(3, 1)
p.h_wealth = np.ones(p.T + p.S) * 1
p.p_wealth = np.ones(p.T + p.S) * 2
p.m_wealth = np.ones(p.T + p.S) * 3
p.tau_payroll = np.ones(p.T + p.S) * 0.15
p.tau_bq = np.ones(p.T + p.S) * 0.1
p.retire = (np.ones(p.T + p.S) * 2).astype(int)
p1 = copy.deepcopy(p)
p2 = copy.deepcopy(p)
p3 = copy.deepcopy(p)
p3.T = 3
p4 = copy.deepcopy(p)
p5 = copy.deepcopy(p)
p5.e = np.array([[0.3, 0.2], [0.5, 0.4], [0.45, 0.3]])
p5.J = 2
p5.T = 3
p5.lambdas = np.array([0.65, 0.35])
# set variables and other parameters for each case
r1 = 0.04
w1 = 1.2
b1 = np.array([0.4, 0.3, 0.5])
n1 = np.array([0.8, 0.4, 0.7])
BQ1 = np.array([0.3])
bq1 = BQ1 / p1.lambdas[0]
tr1 = np.array([0.12])
theta1 = np.array([0.225])
예제 #4
0
@pytest.mark.parametrize('n,params,expected',
                         test_data,
                         ids=['1', '2', '3', '4', '5', '6', '7', '8'])
def test_marg_ut_labor(n, params, expected):
    # Test marginal utility of labor calculation
    test_value = household.marg_ut_labor(n, params.chi_n, params)

    assert np.allclose(test_value, expected)


p1 = Specifications()
p1.zeta = np.array([[0.1, 0.3], [0.15, 0.4], [0.05, 0.0]])
p1.S = 3
p1.J = 2
p1.T = 3
p1.lambdas = np.array([0.6, 0.4])
p1.omega_SS = np.array([0.25, 0.25, 0.5])
p1.omega = np.tile(p1.omega_SS.reshape((1, p1.S)), (p1.T, 1))
BQ1 = 2.5
p1.use_zeta = True
expected1 = np.array([[1.66666667, 7.5], [2.5, 10.0], [0.416666667, 0.0]])
p2 = Specifications()
p2.zeta = np.array([[0.1, 0.3], [0.15, 0.4], [0.05, 0.0]])
p2.S = 3
p2.J = 2
p2.T = 3
p2.lambdas = np.array([0.6, 0.4])
p2.omega_SS = np.array([0.25, 0.25, 0.5])
p2.omega = np.tile(p2.omega_SS.reshape((1, p2.S)), (p2.T, 1))
p2.use_zeta = True