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

Add round to half template method #28948

Merged
merged 2 commits into from Nov 22, 2019
Merged

Conversation

@tofuSCHNITZEL
Copy link
Contributor

tofuSCHNITZEL commented Nov 22, 2019

Description:

extended the round function to accept "half" as a method which will round a number to the nearest .5 value.

2.1 | round(1,"half") => 2.0
2.2 | round(1,"half") => 2.0
2.3 | round(1,"half") => 2.5
2.7 | round(1,"half") => 2.5
2.8 | round(1,"half") => 3.0

Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#11257

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the [development checklist][dev-checklist]

If user exposed functionality or configuration variables are added/changed:

Signed-off-by: Tobias Perschon <tobias@perschon.at>
@tofuSCHNITZEL tofuSCHNITZEL requested a review from home-assistant/core as a code owner Nov 22, 2019
@project-bot project-bot bot added this to Needs review in Dev Nov 22, 2019
@tofuSCHNITZEL tofuSCHNITZEL mentioned this pull request Nov 22, 2019
2 of 2 tasks complete
@MartinHjelmare MartinHjelmare changed the title added round to half method Add round to half template method Nov 22, 2019
@balloob

This comment has been minimized.

Copy link
Member

balloob commented Nov 22, 2019

Can you add a test

Signed-off-by: Tobias Perschon <tobias@perschon.at>
@tofuSCHNITZEL

This comment has been minimized.

Copy link
Contributor Author

tofuSCHNITZEL commented Nov 22, 2019

Can you add a test

sure I've added one test. should I add more cases for different values?

Copy link
Member

balloob left a comment

Thanks !

Dev automation moved this from Needs review to Reviewer approved Nov 22, 2019
@balloob balloob merged commit d92f486 into home-assistant:dev Nov 22, 2019
11 checks passed
11 checks passed
CI #20191122.20 succeeded
Details
CI (FullCheck Mypy) FullCheck Mypy succeeded
Details
CI (FullCheck Pylint) FullCheck Pylint succeeded
Details
CI (Overview CheckFormat) Overview CheckFormat succeeded
Details
CI (Overview Lint) Overview Lint succeeded
Details
CI (Overview Validate) Overview Validate succeeded
Details
CI (Tests PyTest Python36) Tests PyTest Python36 succeeded
Details
CI (Tests PyTest Python37) Tests PyTest Python37 succeeded
Details
cla-bot Everyone involved has signed the CLA
codecov/patch 100% of diff hit (target 94.47%)
Details
codecov/project 94.46% (target 90%)
Details
Dev automation moved this from Reviewer approved to Done Nov 22, 2019
@tofuSCHNITZEL tofuSCHNITZEL deleted the tofuSCHNITZEL:round-to-half branch Nov 22, 2019
@lock lock bot locked and limited conversation to collaborators Nov 23, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
Dev
  
Done
3 participants
You can’t perform that action at this time.