diff options
author | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2022-09-08 14:24:39 +0100 |
---|---|---|
committer | Dmitrii Agibov <dmitrii.agibov@arm.com> | 2022-09-09 17:21:48 +0100 |
commit | f5b293d0927506c2a979a091bf0d07ecc78fa181 (patch) | |
tree | 4de585b7cb6ed34da8237063752270189a730a41 /tests/test_utils_types.py | |
parent | cde0c6ee140bd108849bff40467d8f18ffc332ef (diff) | |
download | mlia-f5b293d0927506c2a979a091bf0d07ecc78fa181.tar.gz |
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
Diffstat (limited to 'tests/test_utils_types.py')
-rw-r--r-- | tests/test_utils_types.py | 9 |
1 files changed, 4 insertions, 5 deletions
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 |