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 openfisca-core requirement from <26,>=25 to >=25,<27 #87

Merged
merged 6 commits into from
Feb 24, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions notebooks/demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@
},
"outputs": [],
"source": [
"from openfisca_tunisia.scenarios import init_single_entity\n",
"\n",
"years = [2012, 2013, 2014, 2017, 2018]\n",
"salaire_de_base_max = 20000\n",
"simulation = tax_benefit_system.new_scenario().init_single_entity(\n",
"simulation = init_single_entity(tax_benefit_system.new_scenario(),\n",
" period = 2014,\n",
" axes = [\n",
" [\n",
Expand Down Expand Up @@ -138,9 +140,11 @@
},
"outputs": [],
"source": [
"from openfisca_tunisia.scenarios import init_single_entity\n",
"\n",
"salaire_de_base_max = 20000\n",
"simulations = [\n",
" tax_benefit_system.new_scenario().init_single_entity(\n",
" init_single_entity(tax_benefit_system.new_scenario(),\n",
" period = 2017,\n",
" parent1 = dict(age = 40, regime_securite_sociale = regime_securite_sociale, salaire_de_base = 20000),\n",
" ).new_simulation()\n",
Expand Down
648 changes: 36 additions & 612 deletions openfisca_tunisia/scenarios.py

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions openfisca_tunisia/tunisia_taxbenefitsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import os

from openfisca_core.taxbenefitsystems import TaxBenefitSystem
from . import decompositions, entities, scenarios
from openfisca_tunisia import decompositions, entities, scenarios


COUNTRY_DIR = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -23,7 +23,6 @@ class TunisiaTaxBenefitSystem(TaxBenefitSystem):
def __init__(self):
# We initialize our tax and benefit system with the general constructor
super(TunisiaTaxBenefitSystem, self).__init__(entities.entities)
self.Scenario = scenarios.Scenario

# We add to our tax and benefit system all the variables
self.add_variables_from_directory(os.path.join(COUNTRY_DIR, 'model'))
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
),
include_package_data = True, # Will read MANIFEST.in
install_requires = [
'OpenFisca-Core >= 25, < 26',
'OpenFisca-Core >=25,<27',
'PyYAML >= 3.10',
'scipy >= 0.12',
],
Expand Down
19 changes: 12 additions & 7 deletions tests/core_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,23 @@
import datetime

from openfisca_tunisia import TunisiaTaxBenefitSystem
from openfisca_tunisia.scenarios import init_single_entity


tax_benefit_system = TunisiaTaxBenefitSystem()


def check_1_parent(year = 2011):
scenario = tax_benefit_system.new_scenario().init_single_entity(
axes = [dict(
count = 3,
name = 'salaire_imposable',
max = 100000,
min = 0,
)],
scenario = init_single_entity(
tax_benefit_system.new_scenario(),
axes = [[
dict(
count = 3,
name = 'salaire_imposable',
max = 100000,
min = 0,
)
]],
period = year,
parent1 = dict(date_naissance = datetime.date(year - 40, 1, 1)),
)
Expand Down
7 changes: 5 additions & 2 deletions tests/test_basics.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from openfisca_tunisia.model.prelevements_obligatoires.cotisations_sociales import TypesRegimeSecuriteSociale
from openfisca_tunisia.model.base import *
from openfisca_tunisia.scenarios import init_single_entity
from tests import base


Expand Down Expand Up @@ -34,8 +35,10 @@ def check_run(simulation, period):

def test_basics():
for scenario_arguments in scenarios_arguments:
scenario = base.tax_benefit_system.new_scenario()
scenario.init_single_entity(**scenario_arguments)
scenario = init_single_entity(
base.tax_benefit_system.new_scenario(),
**scenario_arguments
)
simulation = scenario.new_simulation(debug = False)
period = scenario_arguments['period']
yield check_run, simulation, period
Expand Down
10 changes: 6 additions & 4 deletions tests/test_prestations_familiales.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-

from openfisca_tunisia.model.base import *
from openfisca_tunisia.scenarios import init_single_entity
from tests import base

import datetime
Expand All @@ -14,23 +15,24 @@
def test_contribution_frais_creche():
year = 2011
month = '2011-01'
simulation = base.tax_benefit_system.new_scenario().init_single_entity(
simulation = init_single_entity(
base.tax_benefit_system.new_scenario(),
period = year,
parent1 = dict(age = 40),
parent2 = dict(
date_naissance = datetime.date(1972, 1, 1),
),
enfants = [
dict(
id = 'Behija',
# id = 'Behija',
date_naissance = '1992-01-01',
),
dict(
id = 'Hassen',
# id = 'Hassen',
date_naissance = '2002-01-01',
),
dict(
id = 'Thoura',
# id = 'Thoura',
date_naissance = '2008-12-31',
)
]
Expand Down
4 changes: 3 additions & 1 deletion tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@


from tests.base import tax_benefit_system
from openfisca_tunisia.scenarios import init_single_entity


def test_simple():
year = 2011
simulation = tax_benefit_system.new_scenario().init_single_entity(
simulation = init_single_entity(
tax_benefit_system.new_scenario(),
period = year,
parent1 = dict(age = 40),
).new_simulation(debug = True)
Expand Down