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_download.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_download.py')
-rw-r--r-- | tests/test_utils_download.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/tests/test_utils_download.py b/tests/test_utils_download.py index 4f8e2dc..28af74f 100644 --- a/tests/test_utils_download.py +++ b/tests/test_utils_download.py @@ -1,11 +1,12 @@ # SPDX-FileCopyrightText: Copyright 2022, Arm Limited and/or its affiliates. # SPDX-License-Identifier: Apache-2.0 """Tests for download functionality.""" +from __future__ import annotations + from contextlib import ExitStack as does_not_raise from pathlib import Path from typing import Any from typing import Iterable -from typing import Optional from unittest.mock import MagicMock from unittest.mock import PropertyMock @@ -17,7 +18,7 @@ from mlia.utils.download import DownloadArtifact def response_mock( - content_length: Optional[str], content_chunks: Iterable[bytes] + content_length: str | None, content_chunks: Iterable[bytes] ) -> MagicMock: """Mock response object.""" mock = MagicMock(spec=requests.Response) @@ -59,9 +60,9 @@ def test_download( show_progress: bool, tmp_path: Path, monkeypatch: pytest.MonkeyPatch, - content_length: Optional[str], + content_length: str | None, content_chunks: Iterable[bytes], - label: Optional[str], + label: str | None, ) -> None: """Test function download.""" monkeypatch.setattr( @@ -97,7 +98,7 @@ def test_download( ) def test_download_artifact_download_to( monkeypatch: pytest.MonkeyPatch, - content_length: Optional[str], + content_length: str | None, content_chunks: Iterable[bytes], sha256_hash: str, expected_error: Any, |