def test_comparison(): population_dataframe = create_testing_population_dataframe(year_start=2001, year_end=2261, population=2) profiles_dataframe = create_constant_profiles_dataframe( population_dataframe, tax=1) r = 0.00 g = 0.00 n = 0.00 simulation = Simulation() simulation.population = population_dataframe simulation.population_alt = population_dataframe simulation.profiles = profiles_dataframe net_gov_wealth = -10 net_gov_spending = 0 taxes_list = ['tax'] payments_list = ['sub'] simulation.set_population_projection(year_length=simulation.year_length, method="exp_growth") simulation.set_tax_projection(method="per_capita", rate=g) simulation.set_growth_rate(g) simulation.set_discount_rate(r) simulation.set_population_growth_rate(n) simulation.set_gov_wealth(net_gov_wealth) simulation.set_gov_spendings(net_gov_spending, default=True) simulation.create_cohorts() simulation.create_present_values(typ='tax') simulation.cohorts_alt = simulation.cohorts simulation.cohorts_alt.loc[ [x == 2102 for x in simulation.cohorts_alt.index.get_level_values(2)], 'tax'] = (-100) simulation.create_present_values(typ='tax', default=False) ipl_base = simulation.compute_ipl(typ='tax') ipl_alt = simulation.compute_ipl(typ='tax', default=False, precision=False) #Saving the decomposed ipl: to_save = simulation.break_down_ipl(typ='tax', default=False, threshold=60) # to_save = age_class_pv xls = "C:/Users/Utilisateur/Documents/GitHub/ga/src/countries/france/sources/Carole_Bonnet/choc_test_alt.xlsx" to_save.to_excel(xls, 'ipl') print ipl_base print ipl_alt assert ipl_base == -105232
def test_comparison(): population_dataframe = create_testing_population_dataframe(year_start=2001, year_end=2261, population=2) profiles_dataframe = create_constant_profiles_dataframe(population_dataframe, tax=1) r = 0.00 g = 0.00 n = 0.00 simulation = Simulation() simulation.population = population_dataframe simulation.population_alt = population_dataframe simulation.profiles = profiles_dataframe net_gov_wealth = -10 net_gov_spending = 0 taxes_list = ['tax'] payments_list = ['sub'] simulation.set_population_projection(year_length=simulation.year_length, method="exp_growth") simulation.set_tax_projection(method="per_capita", rate=g) simulation.set_growth_rate(g) simulation.set_discount_rate(r) simulation.set_population_growth_rate(n) simulation.set_gov_wealth(net_gov_wealth) simulation.set_gov_spendings(net_gov_spending, default=True) simulation.create_cohorts() simulation.create_present_values(typ='tax') simulation.cohorts_alt = simulation.cohorts simulation.cohorts_alt.loc[[x==2102 for x in simulation.cohorts_alt.index.get_level_values(2)], 'tax'] = (-100) simulation.create_present_values(typ='tax', default=False) ipl_base = simulation.compute_ipl(typ='tax') ipl_alt = simulation.compute_ipl(typ='tax', default=False, precision=False) #Saving the decomposed ipl: to_save = simulation.break_down_ipl(typ='tax', default=False, threshold=60) # to_save = age_class_pv xls = os.path.join(SRC_PATH, 'test_comparison.xlsx') to_save.to_excel(xls, 'ipl') print ipl_base print ipl_alt assert ipl_base == -105232