Ejemplo n.º 1
0
def test_compute_gen_imbalance():
    size_generation = 1
    cohort = create_neutral_profiles_cohort(population=size_generation)
    simulation = Simulation()
    simulation.discount_rate = 0
    simulation.growth_rate = 0
    simulation.cohorts = cohort
    simulation.create_present_values('tax')
    gen_imbalance = simulation.compute_gen_imbalance(typ='tax')
    #     print gen_imbalance
    assert gen_imbalance == -5000.0 / (2 * 199.0)
Ejemplo n.º 2
0
def test_compute_gen_imbalance():
    size_generation = 1
    cohort = create_neutral_profiles_cohort(population = size_generation)
    simulation = Simulation()    
    simulation.discount_rate = 0
    simulation.growth_rate = 0
    simulation.cohorts = cohort
    simulation.create_present_values('tax')
    gen_imbalance = simulation.compute_gen_imbalance(typ = 'tax')
#     print gen_imbalance
    assert gen_imbalance[0] == -5000.0/(2*199.0), gen_imbalance[1] == -5000.0/(2*199.0)
Ejemplo n.º 3
0
def test_compute_gen_imbalance():
    size_generation = 1
    cohort = create_neutral_profiles_cohort(population = size_generation)
    simulation = Simulation()    
    simulation.discount_rate = 0
    simulation.growth_rate = 0
    simulation.cohorts = cohort
    simulation.create_present_values('tax')
    print simulation.aggregate_pv.tail(20).to_string()
    print simulation.cohorts.head(20).to_string()
    gen_imbalance = simulation.compute_gen_imbalance(typ = 'tax', to_return='difference')
#     print gen_imbalance, -5000.0/(2*199.0)
    assert gen_imbalance == -5000.0/(2*199.0)
Ejemplo n.º 4
0
def test_save_simulation():
    size_generation = 1
    cohort = create_neutral_profiles_cohort(population = size_generation)
    simulation = Simulation()
    simulation.country = 'france'
    simulation.discount_rate = 0
    simulation.growth_rate = 0
    simulation.cohorts = cohort
    simulation.create_present_values('tax')
    simulation.save_simulation(filename='test_save')
    
    store = HDFStore(os.path.join(SRC_PATH,'countries','france','sources', 'Output_folder','test_save.h5'))
    assert store['aggregate_pv'] is not None