Skip to content

Commit

Permalink
test mulitple types of mtr
Browse files Browse the repository at this point in the history
  • Loading branch information
jdebacker committed Apr 11, 2018
1 parent 96e36a3 commit a515099
Showing 1 changed file with 86 additions and 20 deletions.
106 changes: 86 additions & 20 deletions ogusa/tests/test_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,33 +97,99 @@ def test_ETR_income(b, n, e, tax_func_type, etr_params, expected):
assert np.allclose(test_ETR_income, expected)


@pytest.mark.parametrize('analytical_mtrs,expected',
[(True,
np.array([0.80167516, 0.80164698, 0.80168175])),
(False,
np.array([0.45239409, 0.73598958, 0.65126073]))],
ids=['Analytical_mtr=True', 'Analytical_mtr=False'])
def test_MTR_income(analytical_mtrs, expected):
@pytest.mark.parametrize('tax_func_type,analytical_mtrs,etr_params,mtr_params,expected',
[('DEP', True,
np.array([
[0.001, 0.002, 0.003, 0.0015, 0.8,
-0.14, 0.8, -0.15, 0.15, 0.16, -0.15,
0.83],
[0.002, 0.001, 0.002, 0.04, 0.8, -0.14,
0.8, -0.15, 0.15, 0.16, -0.15, 0.83],
[0.011, 0.001, 0.003, 0.06, 0.8, -0.14,
0.8, -0.15, 0.15, 0.16, -0.15, 0.83]]),
np.array([
[0.001, 0.002, 0.003, 0.0015, 0.68,
-0.17, 0.8, -0.42, 0.18, 0.43, -0.42,
0.96],
[0.001, 0.002, 0.003, 0.0015, 0.65,
-0.17, 0.8, -0.42, 0.18, 0.33, -0.12,
0.90],
[0.001, 0.002, 0.003, 0.0015, 0.56,
-0.17, 0.8, -0.42, 0.18, 0.38, -0.22,
0.65]]),
np.array([0.80167516, 0.80164698,
0.80168175])),
('DEP', False,
np.array([
[0.001, 0.002, 0.003, 0.0015, 0.8,
-0.14, 0.8, -0.15, 0.15, 0.16, -0.15,
0.83],
[0.002, 0.001, 0.002, 0.04, 0.8, -0.14,
0.8, -0.15, 0.15, 0.16, -0.15, 0.83],
[0.011, 0.001, 0.003, 0.06, 0.8, -0.14,
0.8, -0.15, 0.15, 0.16, -0.15, 0.83]]),
np.array([
[0.001, 0.002, 0.003, 0.0015, 0.68,
-0.17, 0.8, -0.42, 0.18, 0.43, -0.42,
0.96],
[0.001, 0.002, 0.003, 0.0015, 0.65,
-0.17, 0.8, -0.42, 0.18, 0.33, -0.12,
0.90],
[0.001, 0.002, 0.003, 0.0015, 0.56,
-0.17, 0.8, -0.42, 0.18, 0.38, -0.22,
0.65]]),
np.array([0.45239409, 0.73598958,
0.65126073])),
('GS', False,
np.array([
[0.396, 0.7, 0.9, 0, 0, 0, 0, 0, 0, 0, 0,
0],
[0.396, 0.7, 0.9, 0, 0, 0, 0, 0, 0, 0, 0,
0],
[0.6, 0.5, 0.6, 0, 0, 0, 0, 0, 0, 0, 0,
0]]),
np.array([
[0.396, 0.7, 0.9, 0, 0, 0, 0, 0, 0, 0, 0,
0],
[0.396, 0.7, 0.9, 0, 0, 0, 0, 0, 0, 0, 0,
0],
[0.6, 0.5, 0.6, 0, 0, 0, 0, 0, 0, 0, 0,
0]]),
np.array([0.395999995, 0.395999983,
0.599999478])),
('DEP_totalinc', False,
np.array([
[0.001, 0.002, 0.003, 0.0015, 0.8,
-0.14, 0.8, -0.15, 0.15, 0.16, -0.15,
0.83],
[0.002, 0.001, 0.002, 0.04, 0.8, -0.14,
0.8, -0.15, 0.15, 0.16, -0.15, 0.83],
[0.011, 0.001, 0.003, 0.06, 0.8, -0.14,
0.8, -0.15, 0.15, 0.16, -0.15, 0.83]]),
np.array([
[0.001, 0.002, 0.003, 0.0015, 0.68,
-0.17, 0.8, -0.42, 0.18, 0.43, -0.42,
0.96],
[0.001, 0.002, 0.003, 0.0015, 0.65,
-0.17, 0.8, -0.42, 0.18, 0.33, -0.12,
0.90],
[0.001, 0.002, 0.003, 0.0015, 0.56,
-0.17, 0.8, -0.42, 0.18, 0.38, -0.22,
0.65]]),
np.array([0.439999714, 0.709998696,
0.519999185]))],
ids=['DEP, analytical mtr',
'DEP, not analytical mtr', 'GS',
'DEP_totalinc'])
def test_MTR_income(tax_func_type, analytical_mtrs, etr_params,
mtr_params, expected):
# Test the MTR on income function
tax_func_type = 'DEP'
r = 0.04
w = 1.2
b = np.array([0.4, 0.3, 0.5])
n = np.array([0.8, 0.4, 0.7])
e = np.array([0.5, 0.45, 0.3])
factor = 110000
etr_params = np.array([[0.001, 0.002, 0.003, 0.0015, 0.8, -0.14, 0.8,
-0.15, 0.15, 0.16, -0.15, 0.83],
[0.002, 0.001, 0.002, 0.04, 0.8, -0.14, 0.8,
-0.15, 0.15, 0.16, -0.15, 0.83],
[0.011, 0.001, 0.003, 0.06, 0.8, -0.14, 0.8,
-0.15, 0.15, 0.16, -0.15, 0.83]])
mtr_params = np.array([[0.001, 0.002, 0.003, 0.0015, 0.68, -0.17, 0.8,
-0.42, 0.18, 0.43, -0.42, 0.96],
[0.001, 0.002, 0.003, 0.0015, 0.65, -0.17, 0.8,
-0.42, 0.18, 0.33, -0.12, 0.90],
[0.001, 0.002, 0.003, 0.0015, 0.56, -0.17, 0.8,
-0.42, 0.18, 0.38, -0.22, 0.65]])

test_mtr = tax.MTR_income(r, w, b, n, factor, (e, etr_params,
mtr_params,
Expand Down

0 comments on commit a515099

Please sign in to comment.