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

Allow non-integral inputs to int variables #780

Merged
merged 3 commits into from
Nov 29, 2018
Merged

Conversation

Morendil
Copy link
Contributor

Fixes #463

Technical changes

  • Allow non-integral inputs to int variables

The unit test included in this PR shows that a Holder will happily accept an array of float as an input to an int variable.

The underlying cause here is that parsing test cases still relies on scenarios which we would like to drop support for, per #716. Scenarios in turn rely on columns, of which the code says they are "considered deprecated". Columns and scenarios rely on conv, which I understand is our main remaining link with Biryani. We have been saying for a while that we intend to drop Biryani, e.g. #691.

This looks like a textbook case for applying the Mikado Method. ;)

@Morendil Morendil requested a review from fpagnoux November 26, 2018 11:01
Copy link
Member

@fpagnoux fpagnoux left a comment

Choose a reason for hiding this comment

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

I'm assuming the issue appeared while running a YAML test, as this is the only place where Core uses scenarios.

That makes the functional scope of this PR is included in #781, as that PR will make Core stop using scenarios, and therefore accepts float for int values in YAML tests too.

Depending on how urgent this PR is, I'll let you judge if it's worth merging it before #781, or closing it. In all case, the changelog should clearly mention that this PR only brings changes for YAML tests.

@@ -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():
Copy link
Member

Choose a reason for hiding this comment

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

This tests pass without the change on columns.py 😅

(tests in this file don't use scenarios)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, that's on purpose - documenting at what level the desired behaviour is being blocked.

@Morendil
Copy link
Contributor Author

It's not very urgent, but it allows us to close #463 right away with a clean conscience.

@Morendil Morendil force-pushed the float-inputs-to-ints branch from aeb7d73 to 4aaed75 Compare November 29, 2018 22:18
@Morendil Morendil merged commit 400d82f into master Nov 29, 2018
@Morendil Morendil deleted the float-inputs-to-ints branch November 29, 2018 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants