OpenFisca-France 169.0.0__py3-none-any.whl → 169.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of OpenFisca-France might be problematic. Click here for more details.
- {OpenFisca_France-169.0.0.dist-info → OpenFisca_France-169.1.1.dist-info}/METADATA +14 -8
- {OpenFisca_France-169.0.0.dist-info → OpenFisca_France-169.1.1.dist-info}/RECORD +7 -19
- {OpenFisca_France-169.0.0.dist-info → OpenFisca_France-169.1.1.dist-info}/top_level.txt +0 -1
- openfisca_france/assets/taxe_habitation/source/do_REI_2017-2018_to_csv.do +175 -0
- openfisca_france/model/prestations/minima_sociaux/ppa.py +14 -14
- OpenFisca_France-169.0.0.data/data/share/openfisca/openfisca-france/CHANGELOG.md +0 -10010
- OpenFisca_France-169.0.0.data/data/share/openfisca/openfisca-france/README.md +0 -302
- tests/__init__.py +0 -0
- tests/cache.py +0 -3
- tests/test_basics.py +0 -44
- tests/test_coefficient.py +0 -38
- tests/test_entities.py +0 -163
- tests/test_metadata.py +0 -7
- tests/test_nb_enfants.py +0 -24
- tests/test_parameters.py +0 -11
- tests/test_preprocessing.py +0 -172
- tests/test_scenarios.py +0 -39
- tests/test_tax_rates.py +0 -53
- {OpenFisca_France-169.0.0.dist-info → OpenFisca_France-169.1.1.dist-info}/LICENSE.AGPL.txt +0 -0
- {OpenFisca_France-169.0.0.dist-info → OpenFisca_France-169.1.1.dist-info}/WHEEL +0 -0
tests/test_preprocessing.py
DELETED
|
@@ -1,172 +0,0 @@
|
|
|
1
|
-
'''Teste les cotisations par catégorie de salarié produites à l'issue de l'étape preprocessing.'''
|
|
2
|
-
|
|
3
|
-
from collections import OrderedDict
|
|
4
|
-
|
|
5
|
-
from openfisca_core.parameters.parameter_scale import ParameterScale
|
|
6
|
-
from openfisca_france.model.prelevements_obligatoires.prelevements_sociaux.cotisations_sociales.base import (
|
|
7
|
-
cotisations_employeur_by_categorie_salarie,
|
|
8
|
-
cotisations_salarie_by_categorie_salarie,
|
|
9
|
-
)
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
from .cache import tax_benefit_system
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
cotisations_salarie_by_name = {
|
|
16
|
-
'agff': {
|
|
17
|
-
'start_non_null_date': '2001-04-01',
|
|
18
|
-
'final_null_date': '2019-01-01',
|
|
19
|
-
},
|
|
20
|
-
'agirc_arrco': {
|
|
21
|
-
'start_non_null_date': '2019-01-01',
|
|
22
|
-
},
|
|
23
|
-
'agirc': {
|
|
24
|
-
'start_non_null_date': '1948-01-01',
|
|
25
|
-
'final_null_date': '2019-01-01',
|
|
26
|
-
},
|
|
27
|
-
'apec': {
|
|
28
|
-
'start_non_null_date': '1971-01-01',
|
|
29
|
-
},
|
|
30
|
-
'arrco': {
|
|
31
|
-
'start_non_null_date': '1962-01-01',
|
|
32
|
-
'final_null_date': '2019-01-01',
|
|
33
|
-
},
|
|
34
|
-
'asf': {
|
|
35
|
-
'start_non_null_date': '1984-01-01',
|
|
36
|
-
},
|
|
37
|
-
'ceg': {
|
|
38
|
-
'start_non_null_date': '2019-01-01',
|
|
39
|
-
},
|
|
40
|
-
'cet': {
|
|
41
|
-
'start_non_null_date': '1997-01-01',
|
|
42
|
-
'final_null_date': '2019-01-01',
|
|
43
|
-
},
|
|
44
|
-
'cet2019': {
|
|
45
|
-
'start_non_null_date': '2019-01-01',
|
|
46
|
-
},
|
|
47
|
-
'chomage': {
|
|
48
|
-
'start_non_null_date': '1959-01-01',
|
|
49
|
-
'final_null_date': '2018-10-01',
|
|
50
|
-
},
|
|
51
|
-
'cnracl_s_ti': {
|
|
52
|
-
'start_non_null_date': '1947-09-19',
|
|
53
|
-
},
|
|
54
|
-
'cnracl_s_nbi': {
|
|
55
|
-
'start_non_null_date': '1947-09-19',
|
|
56
|
-
},
|
|
57
|
-
'excep_solidarite': {
|
|
58
|
-
'start_non_null_date': '1982-11-01',
|
|
59
|
-
'final_null_date': '2018-01-01',
|
|
60
|
-
},
|
|
61
|
-
'ircantec': {
|
|
62
|
-
'start_non_null_date': '1971-01-01',
|
|
63
|
-
},
|
|
64
|
-
'maladie_alsace_moselle': {
|
|
65
|
-
'start_non_null_date': '1946-07-01',
|
|
66
|
-
},
|
|
67
|
-
'maladie': {
|
|
68
|
-
'start_non_null_date': '1967-10-01',
|
|
69
|
-
'final_null_date': '2018-01-01',
|
|
70
|
-
},
|
|
71
|
-
'pension': {
|
|
72
|
-
'start_non_null_date': '1925-01-01',
|
|
73
|
-
},
|
|
74
|
-
'rafp': {
|
|
75
|
-
'start_non_null_date': '2005-01-01'
|
|
76
|
-
},
|
|
77
|
-
'vieillesse_deplafonnee': {
|
|
78
|
-
'start_non_null_date': '2004-07-01'
|
|
79
|
-
},
|
|
80
|
-
'vieillesse_plafonnee': {
|
|
81
|
-
'start_non_null_date': '1993-07-01',
|
|
82
|
-
},
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
def test_preprocessing():
|
|
87
|
-
'''Tests the result of parameters preprocessing.'''
|
|
88
|
-
parameters = tax_benefit_system.parameters
|
|
89
|
-
assert set(parameters.cotsoc.cotisations_employeur.children.keys()) == set([
|
|
90
|
-
'prive_cadre',
|
|
91
|
-
'prive_non_cadre',
|
|
92
|
-
'public_non_titulaire',
|
|
93
|
-
'public_titulaire_etat',
|
|
94
|
-
'public_titulaire_hospitaliere',
|
|
95
|
-
'public_titulaire_militaire',
|
|
96
|
-
'public_titulaire_territoriale',
|
|
97
|
-
]), 'Les barèmes de cotisations employeur de certaines catégories de salariés sont manquants'
|
|
98
|
-
|
|
99
|
-
assert set(parameters.cotsoc.cotisations_salarie.children.keys()) == set([
|
|
100
|
-
'prive_cadre',
|
|
101
|
-
'prive_non_cadre',
|
|
102
|
-
'public_non_titulaire',
|
|
103
|
-
'public_titulaire_etat',
|
|
104
|
-
'public_titulaire_hospitaliere',
|
|
105
|
-
# 'public_titulaire_militaire', FIXME Il y en a sûrement mais pas actuellement
|
|
106
|
-
'public_titulaire_territoriale',
|
|
107
|
-
]), 'Les barèmes de cotisations salarié de certaines catégories instant_sde salariés sont manquants'
|
|
108
|
-
|
|
109
|
-
categorie_salaries = [
|
|
110
|
-
'prive_cadre',
|
|
111
|
-
'prive_non_cadre',
|
|
112
|
-
'public_non_titulaire',
|
|
113
|
-
'public_titulaire_etat',
|
|
114
|
-
'public_titulaire_hospitaliere',
|
|
115
|
-
'public_titulaire_territoriale',
|
|
116
|
-
]
|
|
117
|
-
|
|
118
|
-
for categorie_salarie in categorie_salaries:
|
|
119
|
-
test = parameters.cotsoc.cotisations_salarie.children[categorie_salarie].children.keys()
|
|
120
|
-
target = cotisations_salarie_by_categorie_salarie[categorie_salarie]
|
|
121
|
-
assert set(test) == set(target), 'Les barèmes de cotisations salarié {} ne sont pas les bons'.format(
|
|
122
|
-
categorie_salarie)
|
|
123
|
-
|
|
124
|
-
test = parameters.cotsoc.cotisations_employeur.children[categorie_salarie].children.keys()
|
|
125
|
-
target = cotisations_employeur_by_categorie_salarie[categorie_salarie]
|
|
126
|
-
assert set(test) == set(target), 'Les barèmes de cotisations employeur {} ne sont pas les bons'.format(
|
|
127
|
-
categorie_salarie)
|
|
128
|
-
|
|
129
|
-
for categorie_salarie in categorie_salaries:
|
|
130
|
-
cotisations_salaries = set(cotisations_salarie_by_categorie_salarie[categorie_salarie])
|
|
131
|
-
for cotisation_salarie in sorted(cotisations_salaries):
|
|
132
|
-
bareme = parameters.cotsoc.cotisations_salarie.children[categorie_salarie].children[cotisation_salarie]
|
|
133
|
-
|
|
134
|
-
assert isinstance(bareme, ParameterScale), f"{cotisation_salarie} entry's class is {type(bareme)} which is not a ParameterScale"
|
|
135
|
-
|
|
136
|
-
final_null_date = cotisations_salarie_by_name[cotisation_salarie].get('final_null_date')
|
|
137
|
-
if final_null_date:
|
|
138
|
-
thresholds = [
|
|
139
|
-
dict(
|
|
140
|
-
(parameter_at_instant.instant_str, parameter_at_instant.value)
|
|
141
|
-
for parameter_at_instant in bracket.threshold.values_list
|
|
142
|
-
)
|
|
143
|
-
for bracket in bareme.brackets
|
|
144
|
-
]
|
|
145
|
-
final_thresholds_by_instant_str = OrderedDict(sorted(threshold.items(), reverse = True)[0] for threshold in thresholds)
|
|
146
|
-
assert all([final_threshold is None for final_threshold in final_thresholds_by_instant_str.values()]), "Barème salarié {} ne s'éteint pas (il devrait en {})".format(
|
|
147
|
-
cotisation_salarie,
|
|
148
|
-
final_null_date,
|
|
149
|
-
)
|
|
150
|
-
assert max(final_thresholds_by_instant_str.keys()) == final_null_date, "Barème salarié {} ne s'éteint pas en {}".format(
|
|
151
|
-
cotisation_salarie,
|
|
152
|
-
final_null_date,
|
|
153
|
-
)
|
|
154
|
-
|
|
155
|
-
start_non_null_date = cotisations_salarie_by_name[cotisation_salarie].get('start_non_null_date')
|
|
156
|
-
if start_non_null_date:
|
|
157
|
-
thresholds = [
|
|
158
|
-
dict(
|
|
159
|
-
(parameter_at_instant.instant_str, parameter_at_instant.value)
|
|
160
|
-
for parameter_at_instant in bracket.threshold.values_list
|
|
161
|
-
)
|
|
162
|
-
for bracket in bareme.brackets
|
|
163
|
-
]
|
|
164
|
-
start_thresholds_by_instant_str = OrderedDict(sorted(threshold.items())[0] for threshold in thresholds)
|
|
165
|
-
assert all([start_threshold is not None for start_threshold in start_thresholds_by_instant_str.values()]), 'Barème salarié {} ne commence pas à la bonne date (il devrait en {})'.format(
|
|
166
|
-
cotisation_salarie,
|
|
167
|
-
start_non_null_date,
|
|
168
|
-
)
|
|
169
|
-
assert min(start_thresholds_by_instant_str.keys()) == start_non_null_date, 'Barème salarié {} ne commence pas en {}'.format(
|
|
170
|
-
cotisation_salarie,
|
|
171
|
-
start_non_null_date,
|
|
172
|
-
)
|
tests/test_scenarios.py
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
'''Test scenarios.'''
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
from openfisca_france.scenarios import init_single_entity
|
|
5
|
-
|
|
6
|
-
from .cache import tax_benefit_system
|
|
7
|
-
|
|
8
|
-
import pytest
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def test_init_single_entity_parallel_axes():
|
|
12
|
-
'''Test parallel axes scenario initialisation.'''
|
|
13
|
-
year = 2019
|
|
14
|
-
count = 3
|
|
15
|
-
indexes = [0, 1, 2]
|
|
16
|
-
salaire_de_base_axes = [
|
|
17
|
-
dict(
|
|
18
|
-
count = count,
|
|
19
|
-
index = index,
|
|
20
|
-
min = 0,
|
|
21
|
-
max = 15000,
|
|
22
|
-
name = 'salaire_de_base',
|
|
23
|
-
period = year,
|
|
24
|
-
)
|
|
25
|
-
for index in indexes
|
|
26
|
-
]
|
|
27
|
-
|
|
28
|
-
axes = [salaire_de_base_axes]
|
|
29
|
-
|
|
30
|
-
scenario_kwargs = dict(
|
|
31
|
-
parent1 = dict(age = 40),
|
|
32
|
-
parent2 = dict(age = 40),
|
|
33
|
-
enfants = [dict(age = 20)],
|
|
34
|
-
axes = axes,
|
|
35
|
-
period = year
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
simulation = init_single_entity(tax_benefit_system.new_scenario(), **scenario_kwargs).new_simulation()
|
|
39
|
-
assert simulation.calculate_add('salaire_de_base', year) == pytest.approx([0, 0, 0, 7500, 7500, 7500, 15000, 15000, 15000])
|
tests/test_tax_rates.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
from openfisca_core.rates import average_rate, marginal_rate
|
|
2
|
-
|
|
3
|
-
from openfisca_france.scenarios import init_single_entity
|
|
4
|
-
|
|
5
|
-
from .cache import tax_benefit_system
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
def test_average_tax_rate():
|
|
9
|
-
year = 2013
|
|
10
|
-
simulation = init_single_entity(tax_benefit_system.new_scenario(),
|
|
11
|
-
axes = [[
|
|
12
|
-
dict(
|
|
13
|
-
count = 100,
|
|
14
|
-
name = 'salaire_imposable',
|
|
15
|
-
max = 24000,
|
|
16
|
-
min = 0,
|
|
17
|
-
),
|
|
18
|
-
]],
|
|
19
|
-
period = year,
|
|
20
|
-
parent1 = dict(age = 40),
|
|
21
|
-
).new_simulation()
|
|
22
|
-
assert (average_rate(
|
|
23
|
-
target = simulation.calculate('revenu_disponible', period = year),
|
|
24
|
-
varying = simulation.calculate('revenu_disponible', period = year),
|
|
25
|
-
) == 0).all()
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def test_marginal_tax_rate():
|
|
29
|
-
year = 2013
|
|
30
|
-
simulation = init_single_entity(tax_benefit_system.new_scenario(),
|
|
31
|
-
axes = [[
|
|
32
|
-
dict(
|
|
33
|
-
count = 10000,
|
|
34
|
-
name = 'salaire_imposable',
|
|
35
|
-
max = 1000000,
|
|
36
|
-
min = 0,
|
|
37
|
-
),
|
|
38
|
-
]],
|
|
39
|
-
period = year,
|
|
40
|
-
parent1 = dict(age = 40),
|
|
41
|
-
).new_simulation()
|
|
42
|
-
assert (marginal_rate(
|
|
43
|
-
target = simulation.calculate('revenu_disponible', period = year),
|
|
44
|
-
varying = simulation.calculate('revenu_disponible', period = year),
|
|
45
|
-
) == 0).all()
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if __name__ == '__main__':
|
|
49
|
-
import logging
|
|
50
|
-
import sys
|
|
51
|
-
logging.basicConfig(level = logging.ERROR, stream = sys.stdout)
|
|
52
|
-
test_marginal_tax_rate()
|
|
53
|
-
test_average_tax_rate()
|
|
File without changes
|
|
File without changes
|