Skip to content

Commit

Permalink
Fix mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
rikroe committed Aug 4, 2023
1 parent 80a7f7f commit 8df98f0
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
repos:
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: v0.0.265
rev: v0.0.282
hooks:
- id: ruff
args:
- --fix
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
args:
- --safe
- --quiet
files: ^((bimmer_connected|test)/.+)?[^/]+\.py$
- repo: https://github.com/codespell-project/codespell
rev: v2.2.4
rev: v2.2.5
hooks:
- id: codespell
args:
Expand All @@ -24,7 +24,7 @@ repos:
exclude_types: [csv, json]
exclude: ^test/responses/
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.2.0
rev: v1.4.1
hooks:
- id: mypy
name: mypy
Expand Down
4 changes: 2 additions & 2 deletions test/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Fixtures for BMW tests."""
from typing import Optional
from typing import Generator, Optional

try:
from unittest import mock
Expand Down Expand Up @@ -27,7 +27,7 @@


@pytest.fixture
def bmw_fixture(request: pytest.FixtureRequest) -> respx.MockRouter:
def bmw_fixture(request: pytest.FixtureRequest) -> Generator[respx.MockRouter, None, None]:
"""Patch MyBMW login API calls."""
# Now we can start patching the API calls
router = MyBMWMockRouter(
Expand Down
6 changes: 3 additions & 3 deletions test/test_deprecated_vehicle.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@


@pytest.mark.asyncio
async def test_parsing_attributes(caplog, bmw_fixture: respx.router):
async def test_parsing_attributes(caplog, bmw_fixture: respx.Router):
"""Test parsing different attributes of the vehicle."""
account = await prepare_account_with_vehicles()

Expand All @@ -55,7 +55,7 @@ async def test_parsing_attributes(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_drive_train_attributes(caplog, bmw_fixture: respx.router):
async def test_drive_train_attributes(caplog, bmw_fixture: respx.Router):
"""Test parsing different attributes of the vehicle."""
account = await prepare_account_with_vehicles()

Expand All @@ -79,7 +79,7 @@ async def test_drive_train_attributes(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_deprecated_vehicle(caplog, bmw_fixture: respx.router):
async def test_deprecated_vehicle(caplog, bmw_fixture: respx.Router):
"""Test deprecation warning for ConnectedDriveVehicle."""
account = await prepare_account_with_vehicles()

Expand Down
34 changes: 17 additions & 17 deletions test/test_deprecated_vehicle_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


@pytest.mark.asyncio
async def test_generic(caplog, bmw_fixture: respx.router):
async def test_generic(caplog, bmw_fixture: respx.Router):
"""Test generic attributes."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G26).status

Expand All @@ -40,7 +40,7 @@ async def test_generic(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_range_combustion_no_info(caplog, bmw_fixture: respx.router):
async def test_range_combustion_no_info(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_F31).status

Expand All @@ -57,7 +57,7 @@ async def test_range_combustion_no_info(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_range_combustion(caplog, bmw_fixture: respx.router):
async def test_range_combustion(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G20).status

Expand All @@ -74,7 +74,7 @@ async def test_range_combustion(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_range_phev(caplog, bmw_fixture: respx.router):
async def test_range_phev(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G01).status

Expand All @@ -93,7 +93,7 @@ async def test_range_phev(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_range_rex(caplog, bmw_fixture: respx.router):
async def test_range_rex(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_I01_REX).status

Expand All @@ -112,7 +112,7 @@ async def test_range_rex(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_range_electric(caplog, bmw_fixture: respx.router):
async def test_range_electric(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G26).status

Expand All @@ -130,7 +130,7 @@ async def test_range_electric(caplog, bmw_fixture: respx.router):

@time_machine.travel("2021-11-28 21:28:59 +0000", tick=False)
@pytest.mark.asyncio
async def test_charging_end_time(caplog, bmw_fixture: respx.router):
async def test_charging_end_time(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
account = await prepare_account_with_vehicles()
status = account.get_vehicle(VIN_I01_NOREX).status
Expand All @@ -141,7 +141,7 @@ async def test_charging_end_time(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_charging_time_label(caplog, bmw_fixture: respx.router):
async def test_charging_time_label(caplog, bmw_fixture: respx.Router):
"""Test if the parsing of mileage and range is working."""
account = await prepare_account_with_vehicles()
status = account.get_vehicle(VIN_I20).status
Expand All @@ -151,7 +151,7 @@ async def test_charging_time_label(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_plugged_in_waiting_for_charge_window(caplog, bmw_fixture: respx.router):
async def test_plugged_in_waiting_for_charge_window(caplog, bmw_fixture: respx.Router):
"""G01 is plugged in but not charging, as its waiting for charging window."""
# Should be None on G01 as it is only "charging"
account = await prepare_account_with_vehicles()
Expand All @@ -165,7 +165,7 @@ async def test_plugged_in_waiting_for_charge_window(caplog, bmw_fixture: respx.r


@pytest.mark.asyncio
async def test_condition_based_services(caplog, bmw_fixture: respx.router):
async def test_condition_based_services(caplog, bmw_fixture: respx.Router):
"""Test condition based service messages."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G26).status

Expand All @@ -192,7 +192,7 @@ async def test_condition_based_services(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_parse_f31_no_position(caplog, bmw_fixture: respx.router):
async def test_parse_f31_no_position(caplog, bmw_fixture: respx.Router):
"""Test parsing of F31 data with position tracking disabled in the vehicle."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_F31).status

Expand All @@ -203,7 +203,7 @@ async def test_parse_f31_no_position(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_parse_gcj02_position(caplog, bmw_fixture: respx.router):
async def test_parse_gcj02_position(caplog, bmw_fixture: respx.Router):
"""Test conversion of GCJ02 to WGS84 for china."""
account = await prepare_account_with_vehicles(get_region_from_name("china"))
vehicle = account.get_vehicle(VIN_G01)
Expand All @@ -229,7 +229,7 @@ async def test_parse_gcj02_position(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_lids(caplog, bmw_fixture: respx.router):
async def test_lids(caplog, bmw_fixture: respx.Router):
"""Test features around lids."""
# status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G30).status

Expand All @@ -249,7 +249,7 @@ async def test_lids(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_windows_g31(caplog, bmw_fixture: respx.router):
async def test_windows_g31(caplog, bmw_fixture: respx.Router):
"""Test features around windows."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G01).status

Expand All @@ -264,7 +264,7 @@ async def test_windows_g31(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_door_locks(caplog, bmw_fixture: respx.router):
async def test_door_locks(caplog, bmw_fixture: respx.Router):
"""Test the door locks."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G01).status

Expand All @@ -278,7 +278,7 @@ async def test_door_locks(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_check_control_messages(caplog, bmw_fixture: respx.router):
async def test_check_control_messages(caplog, bmw_fixture: respx.Router):
"""Test handling of check control messages.
F11 is the only vehicle with active Check Control Messages, so we only expect to get something there.
Expand All @@ -298,7 +298,7 @@ async def test_check_control_messages(caplog, bmw_fixture: respx.router):


@pytest.mark.asyncio
async def test_functions_without_data(caplog, bmw_fixture: respx.router):
async def test_functions_without_data(caplog, bmw_fixture: respx.Router):
"""Test functions that do not return any result anymore."""
status = (await prepare_account_with_vehicles()).get_vehicle(VIN_G01).status

Expand Down

0 comments on commit 8df98f0

Please sign in to comment.