From ea571a69979cbd861976cf87f2345033ff04b1c2 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Tue, 11 Jun 2024 16:18:16 +0200 Subject: [PATCH] Fix unnecessary-dunder-call pylint warnings in tests (#119379) --- tests/common.py | 2 +- tests/components/google_assistant_sdk/test_init.py | 1 + tests/components/google_assistant_sdk/test_notify.py | 1 + tests/components/usb/test_init.py | 1 + 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/common.py b/tests/common.py index 9faf7e10712..3f1dea4b720 100644 --- a/tests/common.py +++ b/tests/common.py @@ -1680,7 +1680,7 @@ def import_and_test_deprecated_alias( def help_test_all(module: ModuleType) -> None: """Test module.__all__ is correctly set.""" assert set(module.__all__) == { - itm for itm in module.__dir__() if not itm.startswith("_") + itm for itm in dir(module) if not itm.startswith("_") } diff --git a/tests/components/google_assistant_sdk/test_init.py b/tests/components/google_assistant_sdk/test_init.py index 11b3fbaa03f..f986497ed29 100644 --- a/tests/components/google_assistant_sdk/test_init.py +++ b/tests/components/google_assistant_sdk/test_init.py @@ -149,6 +149,7 @@ async def test_send_text_command( mock_text_assistant.assert_called_once_with( ExpectedCredentials(), expected_language_code, audio_out=False ) + # pylint:disable-next=unnecessary-dunder-call mock_text_assistant.assert_has_calls([call().__enter__().assist(command)]) diff --git a/tests/components/google_assistant_sdk/test_notify.py b/tests/components/google_assistant_sdk/test_notify.py index 0ffdc3c5660..266846b17e1 100644 --- a/tests/components/google_assistant_sdk/test_notify.py +++ b/tests/components/google_assistant_sdk/test_notify.py @@ -50,6 +50,7 @@ async def test_broadcast_no_targets( mock_text_assistant.assert_called_once_with( ExpectedCredentials(), language_code, audio_out=False ) + # pylint:disable-next=unnecessary-dunder-call mock_text_assistant.assert_has_calls([call().__enter__().assist(expected_command)]) diff --git a/tests/components/usb/test_init.py b/tests/components/usb/test_init.py index ce7484a811c..effc63bf8aa 100644 --- a/tests/components/usb/test_init.py +++ b/tests/components/usb/test_init.py @@ -108,6 +108,7 @@ async def test_observer_discovery( hass.bus.async_fire(EVENT_HOMEASSISTANT_STOP) await hass.async_block_till_done() + # pylint:disable-next=unnecessary-dunder-call assert mock_observer.mock_calls == [call.start(), call.__bool__(), call.stop()] -- GitLab