From db5c78f8fdde884a5f52ce68ef0114d0f575d3de Mon Sep 17 00:00:00 2001 From: Chris Date: Fri, 16 Sep 2022 08:44:55 -0700 Subject: [PATCH] linting --- custom_components/mail_and_packages/const.py | 4 ++-- tests/conftest.py | 9 +++++++-- tests/test_helpers.py | 1 + 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/custom_components/mail_and_packages/const.py b/custom_components/mail_and_packages/const.py index de58a4eb..0a7c2f48 100644 --- a/custom_components/mail_and_packages/const.py +++ b/custom_components/mail_and_packages/const.py @@ -398,7 +398,7 @@ "subject": ["is now with your local Evri courier for delivery"], }, "evri_packages": {}, - "evri_tracking": {"pattern": ["H[0-9A-Z]{15}"]} + "evri_tracking": {"pattern": ["H[0-9A-Z]{15}"]}, } # Sensor definitions @@ -699,7 +699,7 @@ native_unit_of_measurement="package(s)", icon="mdi:package-variant-closed", key="evri_packages", - ), + ), ### # !!! Insert new sensors above these two !!! ### diff --git a/tests/conftest.py b/tests/conftest.py index 99bced5c..f1f1d7f8 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -936,6 +936,7 @@ def mock_image_excpetion(): mock_image_excpetion.open.side_effect = Exception("SystemError") yield mock_image_excpetion + @pytest.fixture def mock_image_save_excpetion(): """Fixture to mock Image.""" @@ -946,12 +947,15 @@ def mock_image_save_excpetion(): mock_image_save_excpetion.Image.save.side_effect = Exception("ValueError") yield mock_image_save_excpetion + @pytest.fixture def mock_resizeimage(): """Fixture to mock splitext.""" with patch( "custom_components.mail_and_packages.helpers.Image" - ) as mock_resizeimage, patch("custom_components.mail_and_packages.helpers.ImageOps"): + ) as mock_resizeimage, patch( + "custom_components.mail_and_packages.helpers.ImageOps" + ): yield mock_resizeimage @@ -1033,6 +1037,7 @@ def mock_imap_hermes_out_for_delivery(): mock_conn.select.return_value = ("OK", []) yield mock_conn + @pytest.fixture() def mock_imap_evri_out_for_delivery(): """Mock imap class values.""" @@ -1056,7 +1061,7 @@ def mock_imap_evri_out_for_delivery(): email_file = f.read() mock_conn.fetch.return_value = ("OK", [(b"", email_file.encode("utf-8"))]) mock_conn.select.return_value = ("OK", []) - yield mock_conn + yield mock_conn @pytest.fixture() diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 331b5682..56f14767 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -713,6 +713,7 @@ async def test_hermes_out_for_delivery(hass, mock_imap_hermes_out_for_delivery): assert result["count"] == 1 assert result["tracking"] == ["8888888888888888"] + async def test_evri_out_for_delivery(hass, mock_imap_evri_out_for_delivery): result = get_count( mock_imap_evri_out_for_delivery, "evri_delivering", True, "./", hass