From f5b293d0927506c2a979a091bf0d07ecc78fa181 Mon Sep 17 00:00:00 2001 From: Dmitrii Agibov Date: Thu, 8 Sep 2022 14:24:39 +0100 Subject: MLIA-386 Simplify typing in the source code - Enable deferred annotations evaluation - Use builtin types for type hints whenever possible - Use | syntax for union types - Rename mlia.core._typing into mlia.core.typing Change-Id: I3f6ffc02fa069c589bdd9e8bddbccd504285427a --- tests/test_utils_types.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'tests/test_utils_types.py') diff --git a/tests/test_utils_types.py b/tests/test_utils_types.py index 4909efe..f7e0de8 100644 --- a/tests/test_utils_types.py +++ b/tests/test_utils_types.py @@ -1,9 +1,10 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 """Tests for the types related utility functions.""" +from __future__ import annotations + from typing import Any from typing import Iterable -from typing import Optional import pytest @@ -42,7 +43,7 @@ def test_is_number(value: str, expected_result: bool) -> None: ], ) def test_is_list( - data: Any, cls: type, elem_num: Optional[int], expected_result: bool + data: Any, cls: type, elem_num: int | None, expected_result: bool ) -> None: """Test function is_list.""" assert is_list_of(data, cls, elem_num) == expected_result @@ -70,8 +71,6 @@ def test_only_one_selected(options: Iterable[bool], expected_result: bool) -> No [None, 11, 11], ], ) -def test_parse_int( - value: Any, default: Optional[int], expected_int: Optional[int] -) -> None: +def test_parse_int(value: Any, default: int | None, expected_int: int | None) -> None: """Test function parse_int.""" assert parse_int(value, default) == expected_int -- cgit v1.2.1