Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
epenet committed Sep 14, 2024
1 parent c5d42a2 commit b672b61
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion tests/pylint/test_enforce_type_hints.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@ def test_invalid_config_flow_step(
linter: UnittestLinter, type_hint_checker: BaseChecker
) -> None:
"""Ensure invalid hints are rejected for ConfigFlow step."""
class_node, func_node, arg_node = astroid.extract_node(
type_hint_checker.linter.config.ignore_missing_annotations = True

class_node, func_node, arg_node, func_node2 = astroid.extract_node(
"""
class FlowHandler():
pass
Expand All @@ -329,6 +331,12 @@ async def async_step_zeroconf( #@
device_config: dict #@
):
pass
async def async_step_custom( #@
self,
user_input
):
pass
""",
"homeassistant.components.pylint_test.config_flow",
)
Expand All @@ -354,6 +362,15 @@ async def async_step_zeroconf( #@
end_line=11,
end_col_offset=33,
),
pylint.testutils.MessageTest(
msg_id="hass-return-type",
node=func_node2,
args=("ConfigFlowResult", "async_step_custom"),
line=17,
col_offset=4,
end_line=17,
end_col_offset=31,
),
):
type_hint_checker.visit_classdef(class_node)

Expand Down

0 comments on commit b672b61

Please sign in to comment.