Skip to content

Commit

Permalink
Allow non-integral inputs to int variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Morendil committed Nov 29, 2018
1 parent 56e31c6 commit 4aaed75
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
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
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 4aaed75

Please sign in to comment.