openfisca / openfisca-france-fiscalite-miniere

French mining tax system for OpenFisca
GNU Affero General Public License v3.0
3 stars 2 forks source link

Redevance départementale des mines - Or #1

Closed bonjourmauko closed 4 years ago

bonjourmauko commented 4 years ago

WIP

J'ai l'erreurs suivante lors de l'exécution des tests : §

...
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <openfisca_core.simulation_builder.SimulationBuilder object at 0x11a5c1880>, tax_benefit_system = <openfisca_france.france_taxbenefitsystem.FranceTaxBenefitSystem object at 0x10d4159a0>
input_dict = {'nature': {2018: 'or', 2019: 'or'}, 'quantite': {2018: 1000, 2019: 1000}}

    def build_from_variables(self, tax_benefit_system, input_dict):
        """
            Build a simulation from a Python dict ``input_dict`` describing variables values without expliciting entities.

            This method uses :any:`build_default_simulation` to infer an entity structure

            Example:

            >>> simulation_builder.build_from_variables(
                {'salary': {'2016-10': 12000}}
                )
        """
        count = _get_person_count(input_dict)
        simulation = self.build_default_simulation(tax_benefit_system, count)
        for variable, value in input_dict.items():
            if not isinstance(value, dict):
                if self.default_period is None:
                    raise SituationParsingError([variable],
                        "Can't deal with type: expected object. Input variables should be set for specific periods. For instance: {'salary': {'2017-01': 2000, '2017-02': 2500}}, or {'birth_date': {'ETERNITY': '1980-01-01'}}.")
                simulation.set_input(variable, self.default_period, value)
            else:
                for period_str, dated_value in value.items():
>                   simulation.set_input(variable, period_str, dated_value)

count      = 1
dated_value = 'or'
input_dict = {'nature': {2018: 'or', 2019: 'or'}, 'quantite': {2018: 1000, 2019: 1000}}
period_str = 2019
self       = <openfisca_core.simulation_builder.SimulationBuilder object at 0x11a5c1880>
simulation = <openfisca_core.simulations.Simulation object at 0x11a5c1190>
tax_benefit_system = <openfisca_france.france_taxbenefitsystem.FranceTaxBenefitSystem object at 0x10d4159a0>
value      = {2018: 'or', 2019: 'or'}
variable   = 'nature'

../../../../.pyenv/versions/3.8.0/envs/openfisca-france-fiscalite-miniere-3.8.0/lib/python3.8/site-packages/openfisca_core/simulation_builder.py:150: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <openfisca_core.simulations.Simulation object at 0x11a5c1190>, variable_name = 'nature', period = Period(('year', Instant((2019, 1, 1)), 1)), value = 'or'

    def set_input(self, variable_name, period, value):
        """
            Set a variable's value for a given period

            :param variable: the variable to be set
            :param value: the input value for the variable
            :param period: the period for which the value is setted

            Example:
            >>> from openfisca_country_template import CountryTaxBenefitSystem
            >>> simulation = Simulation(CountryTaxBenefitSystem())
            >>> simulation.set_input('age', '2018-04', [12, 14])
            >>> simulation.get_array('age', '2018-04')
            array([12, 14], dtype=int32)

            If a ``set_input`` property has been set for the variable, this method may accept inputs for periods not matching the ``definition_period`` of the variable. To read more about this, check the `documentation <https://openfisca.org/doc/coding-the-legislation/35_periods.html#automatically-process-variable-inputs-defined-for-periods-not-matching-the-definitionperiod>`_.
        """
        variable = self.tax_benefit_system.get_variable(variable_name, check_existence = True)
        period = periods.period(period)
        if ((variable.end is not None) and (period.start.date > variable.end)):
            return
>       self.get_holder(variable_name).set_input(period, value)

period     = Period(('year', Instant((2019, 1, 1)), 1))
self       = <openfisca_core.simulations.Simulation object at 0x11a5c1190>
value      = 'or'
variable   = <4517353888_-3462467918590995729_redevances.nature object at 0x119e27430>
variable_name = 'nature'

../../../../.pyenv/versions/3.8.0/envs/openfisca-france-fiscalite-miniere-3.8.0/lib/python3.8/site-packages/openfisca_core/simulations.py:427: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <openfisca_core.simulations.Simulation object at 0x11a5c1190>, variable_name = 'nature'

    def get_holder(self, variable_name):
        """
            Get the :any:`Holder` associated with the variable ``variable_name`` for the simulation
        """
>       return self.get_variable_population(variable_name).get_holder(variable_name)

self       = <openfisca_core.simulations.Simulation object at 0x11a5c1190>
variable_name = 'nature'

../../../../.pyenv/versions/3.8.0/envs/openfisca-france-fiscalite-miniere-3.8.0/lib/python3.8/site-packages/openfisca_core/simulations.py:341: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <openfisca_core.simulations.Simulation object at 0x11a5c1190>, variable_name = 'nature'

    def get_variable_population(self, variable_name):
        variable = self.tax_benefit_system.get_variable(variable_name, check_existence = True)
>       return self.populations[variable.entity.key]
E       ValueError: 'société'
E       
E       Unexpected error raised while parsing '/Users/hyperion/Sites/dinsic/openfisca/openfisca-france-fiscalite-miniere/openfisca_france_fiscalite_miniere/tests/test_redevances.yaml'

self       = <openfisca_core.simulations.Simulation object at 0x11a5c1190>
variable   = <4517353888_-3462467918590995729_redevances.nature object at 0x119e27430>
variable_name = 'nature'

../../../../.pyenv/versions/3.8.0/envs/openfisca-france-fiscalite-miniere-3.8.0/lib/python3.8/site-packages/openfisca_core/simulations.py:431: ValueError