mirror of
https://github.com/home-assistant/core.git
synced 2025-08-11 00:25:12 +02:00
Add tests
This commit is contained in:
@@ -478,7 +478,7 @@ def test_invalid_entity_properties(
|
|||||||
# Set bypass option
|
# Set bypass option
|
||||||
type_hint_checker.config.ignore_missing_annotations = False
|
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():
|
class LockEntity():
|
||||||
pass
|
pass
|
||||||
@@ -491,6 +491,12 @@ def test_invalid_entity_properties(
|
|||||||
self
|
self
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def async_lock( #@
|
||||||
|
self,
|
||||||
|
**kwargs
|
||||||
|
) -> bool:
|
||||||
|
pass
|
||||||
""",
|
""",
|
||||||
"homeassistant.components.pylint_test.lock",
|
"homeassistant.components.pylint_test.lock",
|
||||||
)
|
)
|
||||||
@@ -507,6 +513,24 @@ def test_invalid_entity_properties(
|
|||||||
end_line=9,
|
end_line=9,
|
||||||
end_col_offset=18,
|
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)
|
type_hint_checker.visit_classdef(class_node)
|
||||||
|
|
||||||
@@ -528,6 +552,12 @@ def test_ignore_invalid_entity_properties(
|
|||||||
self
|
self
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def async_lock(
|
||||||
|
self,
|
||||||
|
**kwargs
|
||||||
|
) -> bool:
|
||||||
|
pass
|
||||||
""",
|
""",
|
||||||
"homeassistant.components.pylint_test.lock",
|
"homeassistant.components.pylint_test.lock",
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user