Skip to content

Commit

Permalink
Merge pull request #780 from openfisca/float-inputs-to-ints
Browse files Browse the repository at this point in the history
Allow non-integral inputs to int variables
  • Loading branch information
Morendil authored Nov 29, 2018
2 parents 56e31c6 + 4e07eb7 commit 400d82f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# Changelog

### 24.9.8 [#780](https://github.com/openfisca/openfisca-core/pull/780)

- Allow non-integral inputs to int variables

### 24.9.7 [#769](https://github.com/openfisca/openfisca-core/pull/769)

- Unify the protocol for appending sub-parameters
- Ensure `path.to.parameter` syntax works consistently across country and extension

### 24.9.6 [#771](https://github.com/openfisca/openfisca-core/pull/771)

Expand Down
1 change: 0 additions & 1 deletion openfisca_core/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ def input_to_dated_python(self):
@property
def json_to_dated_python(self):
return conv.pipe(
conv.test_isinstance((int, basestring_type)),
conv.make_anything_to_int(accept_expression = True),
)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

setup(
name = 'OpenFisca-Core',
version = '24.9.7',
version = '24.9.8',
author = 'OpenFisca Team',
author_email = 'contact@openfisca.org',
classifiers = [
Expand Down
8 changes: 8 additions & 0 deletions tests/core/test_holders.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,3 +178,11 @@ def test_set_not_chaged_variable():
array = np.asarray([2000])
holder.set_input('2015-01', array)
assert_equal(simulation.calculate('salary', '2015-01'), array)


def test_set_input_float_to_int():
simulation = get_simulation(couple)
age = np.asarray([50.6])
simulation.person.get_holder('age').set_input(period, age)
result = simulation.calculate('age', period)
assert_equal(result, np.asarray([50]))

0 comments on commit 400d82f

Please sign in to comment.