1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-25 05:26:47 +00:00

Various string cleanups (#30435)

* Remove some unnecessary string concatenations

* Replace some simple str.formats with f-strings

* Replace some string concatenations with f-strings
This commit is contained in:
Ville Skyttä
2020-01-03 15:47:06 +02:00
committed by Paulus Schoutsen
parent 5ad209c6fd
commit fa4fa30461
105 changed files with 241 additions and 314 deletions

View File

@@ -663,13 +663,12 @@ class TestStateMachine(unittest.TestCase):
def test_service_call_repr():
"""Test ServiceCall repr."""
call = ha.ServiceCall("homeassistant", "start")
assert str(call) == "<ServiceCall homeassistant.start (c:{})>".format(
call.context.id
)
assert str(call) == f"<ServiceCall homeassistant.start (c:{call.context.id})>"
call2 = ha.ServiceCall("homeassistant", "start", {"fast": "yes"})
assert str(call2) == "<ServiceCall homeassistant.start (c:{}): fast=yes>".format(
call2.context.id
assert (
str(call2)
== f"<ServiceCall homeassistant.start (c:{call2.context.id}): fast=yes>"
)