From a7697526243885f63046029e989f29ad65990833 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Wed, 15 Jun 2022 07:30:45 +0000 Subject: [PATCH] Add tests --- tests/pylint/test_enforce_type_hints.py | 32 ++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/tests/pylint/test_enforce_type_hints.py b/tests/pylint/test_enforce_type_hints.py index 1f601a881a6..262ff93afa8 100644 --- a/tests/pylint/test_enforce_type_hints.py +++ b/tests/pylint/test_enforce_type_hints.py @@ -478,7 +478,7 @@ def test_invalid_entity_properties( # Set bypass option type_hint_checker.config.ignore_missing_annotations = False - class_node, prop_node = astroid.extract_node( + class_node, prop_node, func_node = astroid.extract_node( """ class LockEntity(): pass @@ -491,6 +491,12 @@ def test_invalid_entity_properties( self ): pass + + async def async_lock( #@ + self, + **kwargs + ) -> bool: + pass """, "homeassistant.components.pylint_test.lock", ) @@ -507,6 +513,24 @@ def test_invalid_entity_properties( end_line=9, end_col_offset=18, ), + pylint.testutils.MessageTest( + msg_id="hass-argument-type", + node=func_node, + args=("kwargs", "Any"), + line=14, + col_offset=4, + end_line=14, + end_col_offset=24, + ), + pylint.testutils.MessageTest( + msg_id="hass-return-type", + node=func_node, + args="None", + line=14, + col_offset=4, + end_line=14, + end_col_offset=24, + ), ): type_hint_checker.visit_classdef(class_node) @@ -528,6 +552,12 @@ def test_ignore_invalid_entity_properties( self ): pass + + async def async_lock( + self, + **kwargs + ) -> bool: + pass """, "homeassistant.components.pylint_test.lock", )