From 7d421bf22322904e661f399c776d7982ed9b51d6 Mon Sep 17 00:00:00 2001 From: Michael <35783820+mib1185@users.noreply.github.com> Date: Sun, 22 Jun 2025 19:02:43 +0200 Subject: [PATCH] Fix regex patterns in foobot sensor tests (#147306) --- tests/components/foobot/test_sensor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/components/foobot/test_sensor.py b/tests/components/foobot/test_sensor.py index d9d80191075..f0095effeb4 100644 --- a/tests/components/foobot/test_sensor.py +++ b/tests/components/foobot/test_sensor.py @@ -34,11 +34,11 @@ async def test_default_setup( ) -> None: """Test the default setup.""" aioclient_mock.get( - re.compile("api.foobot.io/v2/owner/.*"), + re.compile(r"api\.foobot\.io/v2/owner/.*"), text=await async_load_fixture(hass, "devices.json", "foobot"), ) aioclient_mock.get( - re.compile("api.foobot.io/v2/device/.*"), + re.compile(r"api\.foobot\.io/v2/device/.*"), text=await async_load_fixture(hass, "data.json", "foobot"), ) assert await async_setup_component(hass, sensor.DOMAIN, {"sensor": VALID_CONFIG}) @@ -65,7 +65,7 @@ async def test_setup_timeout_error( """Expected failures caused by a timeout in API response.""" fake_async_add_entities = MagicMock() - aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), exc=TimeoutError()) + aioclient_mock.get(re.compile(r"api\.foobot\.io/v2/owner/.*"), exc=TimeoutError()) with pytest.raises(PlatformNotReady): await foobot.async_setup_platform(hass, VALID_CONFIG, fake_async_add_entities) @@ -78,7 +78,7 @@ async def test_setup_permanent_error( errors = [HTTPStatus.BAD_REQUEST, HTTPStatus.UNAUTHORIZED, HTTPStatus.FORBIDDEN] for error in errors: - aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), status=error) + aioclient_mock.get(re.compile(r"api\.foobot\.io/v2/owner/.*"), status=error) result = await foobot.async_setup_platform( hass, VALID_CONFIG, fake_async_add_entities ) @@ -93,7 +93,7 @@ async def test_setup_temporary_error( errors = [HTTPStatus.TOO_MANY_REQUESTS, HTTPStatus.INTERNAL_SERVER_ERROR] for error in errors: - aioclient_mock.get(re.compile("api.foobot.io/v2/owner/.*"), status=error) + aioclient_mock.get(re.compile(r"api\.foobot\.io/v2/owner/.*"), status=error) with pytest.raises(PlatformNotReady): await foobot.async_setup_platform( hass, VALID_CONFIG, fake_async_add_entities