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

Fix test_variable_documentation failing test #981

Merged
merged 3 commits into from
Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
# Changelog

### 35.1.1 [#981](https://github.com/openfisca/openfisca-core/pull/981)

#### Technical changes

- Fix false negative web API test following an update in the country template used for testing.

### 35.1.0 [#973](https://github.com/openfisca/openfisca-core/pull/973)

#### Technical changes

- Extend assert_near so it is able to compare dates.

### 35.0.5 [#974](https://github.com/openfisca/openfisca-core/pull/974)

#### Technical changes
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

dev_requirements = [
'autopep8 >= 1.4.0, < 1.6.0',
'flake8 >= 3.7.0, < 3.9.0',
'flake8 >= 3.9.0, < 4.0.0',
'flake8-bugbear >= 19.3.0, < 20.0.0',
'flake8-print >= 3.1.0, < 4.0.0',
'pytest-cov >= 2.6.1, < 3.0.0',
Expand All @@ -37,7 +37,7 @@

setup(
name = 'OpenFisca-Core',
version = '35.1.0',
version = '35.1.1',
author = 'OpenFisca Team',
author_email = 'contact@openfisca.org',
classifiers = [
Expand Down
4 changes: 2 additions & 2 deletions tests/web_api/test_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def test_variable_formula_github_link():


def test_variable_formula_content():
formula_code = "def formula(person, period, parameters):\n return person('salary', period) * parameters(period).taxes.income_tax_rate\n"
formula_code = "def formula(person, period, parameters):\n \"\"\"\n Income tax.\n\n The formula to compute the income tax for a given person at a given period\n \"\"\"\n return person(\"salary\", period) * parameters(period).taxes.income_tax_rate\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it be easier to read as:

Suggested change
formula_code = "def formula(person, period, parameters):\n \"\"\"\n Income tax.\n\n The formula to compute the income tax for a given person at a given period\n \"\"\"\n return person(\"salary\", period) * parameters(period).taxes.income_tax_rate\n"
formula_code = """
def formula(person, period, parameters):
\"\"\"
Income tax.
The formula to compute the income tax for a given person at a given period
\"\"\"
return person("salary", period) * parameters(period).taxes.income_tax_rate
"""

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^^ Suggestion only, I'll hit approve button

assert variable['formulas']['0001-01-01']['content'] == formula_code


Expand Down Expand Up @@ -157,4 +157,4 @@ def test_variable_documentation():
variable = json.loads(response.data.decode('utf-8'))
assert variable['documentation'] == "This allowance was introduced on the 1st of Jan 1980.\nIt disappeared in Dec 2016."

assert variable['formulas']['1980-01-01']['documentation'] == "\nTo compute this allowance, the 'rent' value must be provided for the same month, but 'housing_occupancy_status' is not necessary.\n"
assert variable['formulas']['1980-01-01']['documentation'] == "\nHousing allowance.\n\nThis allowance was introduced on the 1st of Jan 1980.\nCalculating it before this date will always return the variable default value, 0.\n\nTo compute this allowance, the 'rent' value must be provided for the same month,\nbut 'housing_occupancy_status' is not necessary.\n"