openfisca / openfisca-core

OpenFisca core engine. See other repositories for countries-specific code & data.
https://openfisca.org
GNU Affero General Public License v3.0
170 stars 75 forks source link

Enable parametric reform tests within the YAML files #1032

Open nikhilwoodruff opened 3 years ago

nikhilwoodruff commented 3 years ago

Outline

In YAML files, as far as I know the only way to specify parametric reforms is with a Python module applying it. It could be useful to allow parameter overrides in the test, to avoid having to create lots of reform files to run tests with. We've just implemented this in openfisca-us by overriding the test script in OpenFisca-Core - could this feature benefit other models by being in Core? Happy to submit a PR if so.

Here is data (or links to it) that might be useful:

Context

I identify more as a:

benjello commented 3 years ago

@nikhilwoodruff there is a way of using reforms in test file. Not yet included in the online documentation though :-( More details in this PR.

I would love to have the parametric changes available under the reform keyword !

nikhilwoodruff commented 3 years ago

Oh thanks @benjello - hadn't seen that. Yeah I think being able to have parameter changes under that reforms argument would encapsulate this.

Would this example work?


- name: De net a imposable pour individu à net à payer de 14700 TND
  reforms: 
    - openfisca_tunisia.reforms.de_net_a_imposable.de_net_a_imposable
    - parameters.tax.some_parameter: 
        year:2020:5: some_new_value
  period: 2016-12
  absolute_error_margin: 0.5
  input:
    salaire_net_a_payer: 14700 / 12
  output:
    salaire_imposable: 17710 / 12