Add tests

This commit is contained in:
epenet
2022-06-15 07:30:45 +00:00
parent 8db2225878
commit a769752624

View File

@@ -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",
)