Drop single-use constant from pylint plugin (#118540)
* Drop single-use constant from pylint plugin * Typo
This commit is contained in:
parent
85d979847c
commit
7804076064
1 changed files with 3 additions and 7 deletions
|
@ -155,10 +155,6 @@ _TEST_FIXTURES: dict[str, list[str] | str] = {
|
||||||
"unused_tcp_port_factory": "Callable[[], int]",
|
"unused_tcp_port_factory": "Callable[[], int]",
|
||||||
"unused_udp_port_factory": "Callable[[], int]",
|
"unused_udp_port_factory": "Callable[[], int]",
|
||||||
}
|
}
|
||||||
_TEST_FUNCTION_MATCH = TypeHintMatch(
|
|
||||||
function_name="test_*",
|
|
||||||
return_type=None,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
_FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
_FUNCTION_MATCH: dict[str, list[TypeHintMatch]] = {
|
||||||
|
@ -3308,12 +3304,12 @@ class HassTypeHintChecker(BaseChecker):
|
||||||
def _check_test_function(
|
def _check_test_function(
|
||||||
self, node: nodes.FunctionDef, annotations: list[nodes.NodeNG | None]
|
self, node: nodes.FunctionDef, annotations: list[nodes.NodeNG | None]
|
||||||
) -> None:
|
) -> None:
|
||||||
# Check the return type.
|
# Check the return type, should always be `None` for test_*** functions.
|
||||||
if not _is_valid_return_type(_TEST_FUNCTION_MATCH, node.returns):
|
if not _is_valid_type(None, node.returns, True):
|
||||||
self.add_message(
|
self.add_message(
|
||||||
"hass-return-type",
|
"hass-return-type",
|
||||||
node=node,
|
node=node,
|
||||||
args=(_TEST_FUNCTION_MATCH.return_type or "None", node.name),
|
args=("None", node.name),
|
||||||
)
|
)
|
||||||
# Check that all positional arguments are correctly annotated.
|
# Check that all positional arguments are correctly annotated.
|
||||||
for arg_name, expected_type in _TEST_FIXTURES.items():
|
for arg_name, expected_type in _TEST_FIXTURES.items():
|
||||||
|
|
Loading…
Add table
Reference in a new issue