Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update update CSV builder test labels and un-xfail the CSV test #851

Merged
merged 12 commits into from
Mar 19, 2018
2 changes: 1 addition & 1 deletion conda-requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nomkl
taxcalc==0.15.2
taxcalc==0.17.0
btax==0.2.2
ogusa==0.5.8
numba>=0.33.0
Expand Down
2 changes: 1 addition & 1 deletion deploy/fab/dropq_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ dependencies:
- python<=2.7.14,>=2.7.12
- numpy >=1.12.1
- pandas >=0.22.0
- taxcalc =0.15.2
- taxcalc =0.17.0
- btax =0.2.2
- ogusa =0.5.8
- numba
Expand Down
65 changes: 17 additions & 48 deletions webapp/apps/taxbrain/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ def default_taxcalc_data(cls, start_year, metadata=False):
# Display TaxCalc result data
#
TAXCALC_RESULTS_START_YEAR = START_YEAR
TAXCALC_RESULTS_MTABLE_COL_LABELS = taxcalc.DIST_TABLE_LABELS[:-2]
TAXCALC_RESULTS_MTABLE_COL_LABELS = taxcalc.DIST_TABLE_LABELS[:]
TAXCALC_RESULTS_DFTABLE_COL_LABELS = taxcalc.DIFF_TABLE_LABELS[:-2]
TAXCALC_RESULTS_MTABLE_COL_FORMATS = [
# divisor, unit, decimals
Expand All @@ -232,51 +232,33 @@ def default_taxcalc_data(cls, start_year, metadata=False):
[1000000000, 'Dollars', 1], # 'Refundable Credits',
[1000000000, 'Dollars', 1], # 'Individual Income Liabilities',
[1000000000, 'Dollars', 1], # 'Payroll Tax Liablities',
[1000000000, 'Dollars', 1], # 'Combined Payroll and individual Income Tax Liablities'

[1000000000, 'Dollars', 1], # 'Combined Payroll and individual Income Tax Liablities',
[1000000000, 'Dollars', 1], # 'Universal Basic Income',
[1000000000, 'Dollars', 1], # 'Total Cost of Benefits',
[1000000000, 'Dollars', 1], # 'Consumption Value of Benefits',
[1000000000, 'Dollars', 1], # 'Expanded Income',
[1000000000, 'Dollars', 1], # 'After-Tax Expanded Income'
]
TAXCALC_RESULTS_DFTABLE_COL_FORMATS = [
[ 1000, None, 0], # "Count", --> All Tax Units
[ 1000, None, 0], # "Tax Units with Tax Cut",
[ 1, '%',1], # "Percent Tax Decrease" --> "Percent with Tax Cut"
[ 1000, None, 0], # "Tax Units with Tax Cut",
[ 1, '%', 1], # "Percent Tax Increase" --> "Percent with Tax Increase"
[ 1, 'Dollars', 0], # "Average Tax Change"
[ 1, '%', 1], # "Percent Tax Increase" --> "Percent with Tax Increase",
[ 1, 'Dollars', 0], # "Average Tax Change",
[1000000000, 'Dollars', 1], # "Total Tax Difference",
[ 1, '%', 1], # "Share of Overall Change"
[1000000000, 'Dollars', 1], # 'Universal Basic Income',
[1000000000, 'Dollars', 1], # 'Total Cost of Benefits',
[1000000000, 'Dollars', 1], # 'Consumption Value of Benefits',
[ 1, '%', 1], # '% Change in After-Tax Income'
]
TAXCALC_RESULTS_BIN_ROW_KEYS = taxcalc.WEBBIN_ROW_NAMES
TAXCALC_RESULTS_BIN_ROW_KEYS = taxcalc.STANDARD_ROW_NAMES
TAXCALC_RESULTS_BIN_ROW_KEY_LABELS = {
'<$10K':'Less than 10',
'$10-20K':'10-20',
'$20-30K':'20-30',
'$30-40K':'30-40',
'$40-50K':'40-50',
'$50-75K':'50-75',
'$75-100K':'75-100',
'$100-200K':'100-200',
'$200-500K':'200-500',
'$500-1000K':'500-1000',
'>$1000K':'1000+',
'all':'All'
k: k for k in taxcalc.STANDARD_ROW_NAMES
}
TAXCALC_RESULTS_DEC_ROW_KEYS = taxcalc.DECILE_ROW_NAMES[:-3]
# -DEC_ROW_NAMES = ['perc0-10', 'perc10-20', 'perc20-30', 'perc30-40',
# - 'perc40-50', 'perc50-60', 'perc60-70', 'perc70-80',
# - 'perc80-90', 'perc90-100', 'all']
# -
# -BIN_ROW_NAMES = ['less_than_10', 'ten_twenty', 'twenty_thirty', 'thirty_forty',
# - 'forty_fifty', 'fifty_seventyfive', 'seventyfive_hundred',
# - 'hundred_twohundred', 'twohundred_fivehundred',
# - 'fivehundred_thousand', 'thousand_up', 'all']
# +DEC_ROW_NAMES = ['0-10', '10-20', '20-30', '30-40',
# + '40-50', '50-60', '60-70', '70-80',
# + '80-90', '90-100', 'all']
# +
# +BIN_ROW_NAMES = ['<$10K', '$10-20K', '$20-30K', '$30-40K',
# + '$40-50K', '$50-75K', '$75-100K',
# + '$100-200K', '$200-500K',
# + '$500-1000K', '>$1000K', 'all']
TAXCALC_RESULTS_DEC_ROW_KEYS = taxcalc.DECILE_ROW_NAMES
TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = {k: k for k in taxcalc.DECILE_ROW_NAMES}

PRE_TC_0130_RES_MAP = {
'all': 'all',
Expand Down Expand Up @@ -316,19 +298,6 @@ def default_taxcalc_data(cls, start_year, metadata=False):
'fiscal_tot_ref': 'aggr_2'
}

TAXCALC_RESULTS_DEC_ROW_KEY_LABELS = {
'0-10':'0-10%',
'10-20':'10-20%',
'20-30':'20-30%',
'30-40':'30-40%',
'40-50':'40-50%',
'50-60':'50-60%',
'60-70':'60-70%',
'70-80':'70-80%',
'80-90':'80-90%',
'90-100':'90-100%',
'all':'All'
}
TAXCALC_RESULTS_TABLE_LABELS = {
'diff_comb_xbin': 'Combined Payroll and Individual Income Tax: Difference between Base and User plans by expanded income bin',
'diff_comb_xdec': 'Combined Payroll and Individual Income Tax: Difference between Base and User plans by expanded income decile',
Expand Down
2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_0.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_1.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_2.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_3.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_4.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_5.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_6.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_7.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_8.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/response_year_9.json

Large diffs are not rendered by default.

79 changes: 50 additions & 29 deletions webapp/apps/taxbrain/tests/test_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,48 +94,60 @@ def test_format_csv(self):
"aggr_1", "aggr_2"]

bin_keys = [
'<$0K_0',
'<$0K_1',
'<$0K_2',
'=$0K_0',
'=$0K_1',
'=$0K_2',
'$0-10K_0',
'$0-10K_1',
'$0-10K_2',
'$10-20K_0',
'$10-20K_1',
'$10-20K_2',
'$100-200K_0',
'$100-200K_1',
'$100-200K_2',
'$20-30K_0',
'$20-30K_1',
'$20-30K_2',
'$200-500K_0',
'$200-500K_1',
'$200-500K_2',
'$30-40K_0',
'$30-40K_0',
'$30-40K_1',
'$30-40K_2',
'$40-50K_0',
'$40-50K_1',
'$40-50K_2',
'$40-50K_0',
'$40-50K_1',
'$40-50K_2',
'$50-75K_0',
'$50-75K_1',
'$50-75K_2',
'$500-1000K_0',
'$500-1000K_1',
'$500-1000K_2',
'$50-75K_2',
'$75-100K_0',
'$75-100K_1',
'$75-100K_2',
'<$10K_0',
'<$10K_1',
'<$10K_2',
'>$1000K_0',
'>$1000K_1',
'>$1000K_2',
'all_0',
'all_1',
'all_2'
'$100-200K_0',
'$100-200K_1',
'$100-200K_2',
'$200-500K_0',
'$200-500K_1',
'$200-500K_2',
'$500-1000K_0',
'$500-1000K_1',
'$500-1000K_2',
'>$1000K_0',
'>$1000K_1',
'>$1000K_2',
'ALL_0',
'ALL_1',
'ALL_2'
]

dec_keys = [
'0-10_0',
'0-10_1',
'0-10_2',
'0-10n_0',
'0-10n_1',
'0-10n_2',
'0-10z_0',
'0-10z_1',
'0-10z_2',
'0-10p_0',
'0-10p_1',
'0-10p_2',
'10-20_0',
'10-20_1',
'10-20_2',
Expand Down Expand Up @@ -163,9 +175,18 @@ def test_format_csv(self):
'90-100_0',
'90-100_1',
'90-100_2',
'all_0',
'all_1',
'all_2'
'90-95_0',
'90-95_1',
'90-95_2',
'95-99_0',
'95-99_1',
'95-99_2',
'Top 1%_0',
'Top 1%_1',
'Top 1%_2',
'ALL_0',
'ALL_1',
'ALL_2'
]

tot_keys = [u'combined_tax', u'ind_tax', u'payroll_tax']
Expand Down
2 changes: 1 addition & 1 deletion webapp/apps/taxbrain/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def test_taxbrain_post_file(self, data_source, use_assumptions):
check_posted_params(result['tb_dropq_compute'], truth_mods,
str(START_YEAR), data_source=data_source)


@pytest.mark.xfail
def test_taxbrain_view_old_data_model(self):
#Monkey patch to mock out running of compute jobs
get_dropq_compute_from_module('webapp.apps.taxbrain.views')
Expand Down