From 98d36bc374a31dac016ad124dc4506aee053e45c Mon Sep 17 00:00:00 2001 From: "bodong.yang" Date: Sat, 14 Sep 2024 08:42:32 +0000 Subject: [PATCH] test_ecu_info: fix typing --- .../test_configs/test_ecu_info.py | 32 +++++++++++-------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/tests/test_otaclient/test_configs/test_ecu_info.py b/tests/test_otaclient/test_configs/test_ecu_info.py index 20354f62d..fed9ca83a 100644 --- a/tests/test_otaclient/test_configs/test_ecu_info.py +++ b/tests/test_otaclient/test_configs/test_ecu_info.py @@ -15,6 +15,7 @@ from __future__ import annotations +from ipaddress import IPv4Address from pathlib import Path import pytest @@ -39,7 +40,7 @@ ), # case 1.2: valid yaml(array), invalid ecu_info ( - ("- this is an\n" "- yaml file that\n" "- contains a array\n"), + ("- this is an\n- yaml file that\n- contains a array\n"), DEFAULT_ECU_INFO, ), # case 1.2: invalid yaml @@ -50,11 +51,16 @@ # --- case 2: single ECU --- # # case 2.1: basic single ECU ( - ("format_version: 1\n" 'ecu_id: "autoware"\n' 'ip_addr: "192.168.1.1"\n'), + ( + "format_version: 1\n" + 'ecu_id: "autoware"\n' + 'ip_addr: "192.168.1.1"\n' + "bootloader: jetson-cboot\n" + ), ECUInfo( ecu_id="autoware", - ip_addr="192.168.1.1", # type: ignore - bootloader=BootloaderType.AUTO_DETECT, + ip_addr=IPv4Address("192.168.1.1"), + bootloader=BootloaderType.JETSON_CBOOT, ), ), # case 2.2: single ECU with bootloader type specified @@ -67,7 +73,7 @@ ), ECUInfo( ecu_id="autoware", - ip_addr="192.168.1.1", # type: ignore + ip_addr=IPv4Address("192.168.1.1"), bootloader=BootloaderType.GRUB, ), ), @@ -87,17 +93,17 @@ ), ECUInfo( ecu_id="autoware", - ip_addr="192.168.1.1", + ip_addr=IPv4Address("192.168.1.1"), bootloader=BootloaderType.AUTO_DETECT, available_ecu_ids=["autoware", "p1", "p2"], secondaries=[ ECUContact( ecu_id="p1", - ip_addr="192.168.0.11", # type: ignore + ip_addr=IPv4Address("192.168.0.11"), ), ECUContact( ecu_id="p2", - ip_addr="192.168.0.12", # type: ignore + ip_addr=IPv4Address("192.168.0.12"), ), ], ), @@ -108,7 +114,7 @@ "format_version: 1\n" 'ecu_id: "autoware"\n' 'ip_addr: "192.168.1.1"\n' - 'bootloader: "grub"\n' + 'bootloader: "jetson-uefi"\n' 'available_ecu_ids: ["autoware", "p1", "p2"]\n' "secondaries: \n" '- ecu_id: "p1"\n' @@ -118,17 +124,17 @@ ), ECUInfo( ecu_id="autoware", - ip_addr="192.168.1.1", - bootloader=BootloaderType.GRUB, + ip_addr=IPv4Address("192.168.1.1"), + bootloader=BootloaderType.JETSON_UEFI, available_ecu_ids=["autoware", "p1", "p2"], secondaries=[ ECUContact( ecu_id="p1", - ip_addr="192.168.0.11", # type: ignore + ip_addr=IPv4Address("192.168.0.11"), ), ECUContact( ecu_id="p2", - ip_addr="192.168.0.12", # type: ignore + ip_addr=IPv4Address("192.168.0.12"), ), ], ),