Use f-strings in integrations starting with "F"and"G" (#32150)

* Use f-strings in integrations starting with F

* Use f-strings in tests for integrations starting with F

* Use f-strings in integrations starting with G

* Use f-strings in tests for integrations starting with G

* Fix pylint error

* Fix broken test
This commit is contained in:
springstan authored and GitHub committed 2020-02-24 17:54:20 -08:00
1 parent 496bd3dddf
commit ad102b3840
59 files changed
+219 -344

No files matched your search

+4 -6
View File
@@ -48,9 +48,7 @@ class TestGoogleWifiSetup(unittest.TestCase):
@requests_mock.Mocker()
def test_setup_minimum(self, mock_req):
"""Test setup with minimum configuration."""
resource = "{}{}{}".format(
"http://", google_wifi.DEFAULT_HOST, google_wifi.ENDPOINT
)
resource = f"http://{google_wifi.DEFAULT_HOST}{google_wifi.ENDPOINT}"
mock_req.get(resource, status_code=200)
assert setup_component(
self.hass,
@@ -62,7 +60,7 @@ class TestGoogleWifiSetup(unittest.TestCase):
@requests_mock.Mocker()
def test_setup_get(self, mock_req):
"""Test setup with full configuration."""
resource = "{}{}{}".format("http://", "localhost", google_wifi.ENDPOINT)
resource = f"http://localhost{google_wifi.ENDPOINT}"
mock_req.get(resource, status_code=200)
assert setup_component(
self.hass,
@@ -101,7 +99,7 @@ class TestGoogleWifiSensor(unittest.TestCase):
def setup_api(self, data, mock_req):
"""Set up API with fake data."""
resource = "{}{}{}".format("http://", "localhost", google_wifi.ENDPOINT)
resource = f"http://localhost{google_wifi.ENDPOINT}"
now = datetime(1970, month=1, day=1)
with patch("homeassistant.util.dt.now", return_value=now):
mock_req.get(resource, text=data, status_code=200)
@@ -111,7 +109,7 @@ class TestGoogleWifiSensor(unittest.TestCase):
self.sensor_dict = dict()
for condition, cond_list in google_wifi.MONITORED_CONDITIONS.items():
sensor = google_wifi.GoogleWifiSensor(self.api, self.name, condition)
name = "{}_{}".format(self.name, condition)
name = f"{self.name}_{condition}"
units = cond_list[1]
icon = cond_list[2]
self.sensor_dict[condition] = {