Add type hints to core tests (#88478)

This commit is contained in:
epenet 2023-02-20 11:42:56 +01:00 committed by GitHub
parent 26755a6841
commit 5f25b71df7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 1068 additions and 547 deletions

View file

@ -43,7 +43,7 @@ def normalize_yaml_files(check_dict):
return [key.replace(root, "...") for key in sorted(check_dict["yaml_files"].keys())]
def test_bad_core_config(mock_is_file, event_loop):
def test_bad_core_config(mock_is_file, event_loop) -> None:
"""Test a bad core config setup."""
files = {YAML_CONFIG_FILE: BAD_CORE_CONFIG}
with patch_yaml_files(files):
@ -52,7 +52,7 @@ def test_bad_core_config(mock_is_file, event_loop):
assert res["except"]["homeassistant"][1] == {"unit_system": "bad"}
def test_config_platform_valid(mock_is_file, event_loop):
def test_config_platform_valid(mock_is_file, event_loop) -> None:
"""Test a valid platform setup."""
files = {YAML_CONFIG_FILE: BASE_CONFIG + "light:\n platform: demo"}
with patch_yaml_files(files):
@ -65,7 +65,7 @@ def test_config_platform_valid(mock_is_file, event_loop):
assert len(res["yaml_files"]) == 1
def test_component_platform_not_found(mock_is_file, event_loop):
def test_component_platform_not_found(mock_is_file, event_loop) -> None:
"""Test errors if component or platform not found."""
# Make sure they don't exist
files = {YAML_CONFIG_FILE: BASE_CONFIG + "beer:"}
@ -96,7 +96,7 @@ def test_component_platform_not_found(mock_is_file, event_loop):
assert len(res["yaml_files"]) == 1
def test_secrets(mock_is_file, event_loop):
def test_secrets(mock_is_file, event_loop) -> None:
"""Test secrets config checking method."""
secrets_path = get_test_config_dir("secrets.yaml")
@ -126,7 +126,7 @@ def test_secrets(mock_is_file, event_loop):
]
def test_package_invalid(mock_is_file, event_loop):
def test_package_invalid(mock_is_file, event_loop) -> None:
"""Test an invalid package."""
files = {YAML_CONFIG_FILE: BASE_CONFIG + ' packages:\n p1:\n group: ["a"]'}
with patch_yaml_files(files):
@ -142,7 +142,7 @@ def test_package_invalid(mock_is_file, event_loop):
assert len(res["yaml_files"]) == 1
def test_bootstrap_error(event_loop):
def test_bootstrap_error(event_loop) -> None:
"""Test a valid platform setup."""
files = {YAML_CONFIG_FILE: BASE_CONFIG + "automation: !include no.yaml"}
with patch_yaml_files(files):