Improve type hints in google tests (#121169)

This commit is contained in:
epenet 2024-07-04 14:56:01 +02:00 committed by GitHub
parent f78933235d
commit b949240d4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 23 additions and 23 deletions

View File

@ -293,7 +293,7 @@ def mock_calendars_list(
@pytest.fixture
def mock_calendar_get(
aioclient_mock: AiohttpClientMocker,
) -> Callable[[...], None]:
) -> Callable[..., None]:
"""Fixture for returning a calendar get response."""
def _result(
@ -315,7 +315,7 @@ def mock_calendar_get(
@pytest.fixture
def mock_insert_event(
aioclient_mock: AiohttpClientMocker,
) -> Callable[[...], None]:
) -> Callable[..., None]:
"""Fixture for capturing event creation."""
def _expect_result(
@ -330,7 +330,7 @@ def mock_insert_event(
@pytest.fixture(autouse=True)
async def set_time_zone(hass):
async def set_time_zone(hass: HomeAssistant) -> None:
"""Set the time zone for the tests."""
# Set our timezone to CST/Regina so we can check calculations
# This keeps UTC-6 all year round

View File

@ -839,7 +839,7 @@ async def test_websocket_create(
hass: HomeAssistant,
component_setup: ComponentSetup,
test_api_calendar: dict[str, Any],
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
ws_client: ClientFixture,
@ -881,7 +881,7 @@ async def test_websocket_create_all_day(
hass: HomeAssistant,
component_setup: ComponentSetup,
test_api_calendar: dict[str, Any],
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
ws_client: ClientFixture,
@ -1078,7 +1078,7 @@ async def test_readonly_websocket_create(
hass: HomeAssistant,
component_setup: ComponentSetup,
test_api_calendar: dict[str, Any],
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
ws_client: ClientFixture,
@ -1129,7 +1129,7 @@ async def test_readonly_search_calendar(
hass: HomeAssistant,
component_setup: ComponentSetup,
mock_calendars_yaml,
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
ws_client: ClientFixture,

View File

@ -116,7 +116,7 @@ async def primary_calendar_status() -> HTTPStatus | None:
@pytest.fixture(autouse=True)
async def primary_calendar(
mock_calendar_get: Callable[[...], None],
mock_calendar_get: Callable[..., None],
primary_calendar_error: ClientError | None,
primary_calendar_status: HTTPStatus | None,
primary_calendar_email: str,

View File

@ -82,7 +82,7 @@ def assert_state(actual: State | None, expected: State | None) -> None:
def add_event_call_service(
hass: HomeAssistant,
request: pytest.FixtureRequest,
) -> Callable[dict[str, Any], Awaitable[None]]:
) -> Callable[[dict[str, Any]], Awaitable[None]]:
"""Fixture for calling the add or create event service."""
(domain, service_call, data, target) = request.param
@ -422,7 +422,7 @@ async def test_add_event_invalid_params(
mock_calendars_list: ApiResult,
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
add_event_call_service: Callable[dict[str, Any], Awaitable[None]],
add_event_call_service: Callable[[dict[str, Any]], Awaitable[None]],
date_fields: dict[str, Any],
expected_error: type[Exception],
error_match: str | None,
@ -457,14 +457,14 @@ async def test_add_event_date_in_x(
hass: HomeAssistant,
component_setup: ComponentSetup,
mock_calendars_list: ApiResult,
mock_insert_event: Callable[[..., dict[str, Any]], None],
mock_insert_event: Callable[..., None],
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
date_fields: dict[str, Any],
start_timedelta: datetime.timedelta,
end_timedelta: datetime.timedelta,
aioclient_mock: AiohttpClientMocker,
add_event_call_service: Callable[dict[str, Any], Awaitable[None]],
add_event_call_service: Callable[[dict[str, Any]], Awaitable[None]],
) -> None:
"""Test service call that adds an event with various time ranges."""
@ -496,10 +496,10 @@ async def test_add_event_date(
component_setup: ComponentSetup,
mock_calendars_list: ApiResult,
test_api_calendar: dict[str, Any],
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
add_event_call_service: Callable[dict[str, Any], Awaitable[None]],
add_event_call_service: Callable[[dict[str, Any]], Awaitable[None]],
) -> None:
"""Test service call that sets a date range."""
@ -535,11 +535,11 @@ async def test_add_event_date_time(
hass: HomeAssistant,
component_setup: ComponentSetup,
mock_calendars_list: ApiResult,
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
add_event_call_service: Callable[dict[str, Any], Awaitable[None]],
add_event_call_service: Callable[[dict[str, Any]], Awaitable[None]],
) -> None:
"""Test service call that adds an event with a date time range."""
@ -599,7 +599,7 @@ async def test_unsupported_create_event(
mock_calendars_yaml: Mock,
component_setup: ComponentSetup,
mock_calendars_list: ApiResult,
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
@ -636,8 +636,8 @@ async def test_add_event_failure(
mock_calendars_list: ApiResult,
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
mock_insert_event: Callable[[..., dict[str, Any]], None],
add_event_call_service: Callable[dict[str, Any], Awaitable[None]],
mock_insert_event: Callable[..., None],
add_event_call_service: Callable[[dict[str, Any]], Awaitable[None]],
) -> None:
"""Test service calls with incorrect fields."""
@ -661,10 +661,10 @@ async def test_add_event_location(
component_setup: ComponentSetup,
mock_calendars_list: ApiResult,
test_api_calendar: dict[str, Any],
mock_insert_event: Callable[[str, dict[str, Any]], None],
mock_insert_event: Callable[..., None],
mock_events_list: ApiResult,
aioclient_mock: AiohttpClientMocker,
add_event_call_service: Callable[dict[str, Any], Awaitable[None]],
add_event_call_service: Callable[[dict[str, Any]], Awaitable[None]],
) -> None:
"""Test service call that sets a location field."""
@ -879,7 +879,7 @@ async def test_assign_unique_id(
mock_calendars_list: ApiResult,
test_api_calendar: dict[str, Any],
mock_events_list: ApiResult,
mock_calendar_get: Callable[[...], None],
mock_calendar_get: Callable[..., None],
config_entry: MockConfigEntry,
) -> None:
"""Test an existing config is updated to have unique id if it does not exist."""
@ -918,7 +918,7 @@ async def test_assign_unique_id_failure(
test_api_calendar: dict[str, Any],
config_entry: MockConfigEntry,
mock_events_list: ApiResult,
mock_calendar_get: Callable[[...], None],
mock_calendar_get: Callable[..., None],
request_status: http.HTTPStatus,
config_entry_status: ConfigEntryState,
) -> None: