Update on Enum.split#9436
Conversation
- Add more coherence on arguments taken by Enum.split by allowing splits by 1.0 and 0.0
|
Good catch @QuentinDanjou! I believe it would be better though to change each clause of the original Can you please change your PR accordingly and send a test? Thank you! |
Change each clause of the original split function to limit the function call to integers
|
The update looks good. Now we only need a test and we should be good to go. The readme has instructions on how to run tests but feel free to ask if you have any questions! |
|
@josevalim Sorry I didn't get if you mean adding a test to the test suite that test this behavior or simply run the test locally as explained in the readme. Here is the specific test on my local computer: |
|
I meant adding a test. :) |
|
I'm having trouble to understand how this PR allows those values since It seems this fix does not allow this values, it removes every float value instead. Am I right? Or am I missing something? |
|
If that's the case, I believe adding the code below to the I can't do it on the forked branch because of no access :) |
|
❤️ 💚 💙 💛 💜 |
Split was allowing values like 2.0, and higher but throwing on 1.0, 0.0, and -1.0 which was not coherent. Even it does not make any sense to give floating values, it feels weird that it allows some of them and not others.
This fix now allow these values.