mirror of
https://github.com/arcan1s/ahriman.git
synced 2025-07-29 13:49:57 +00:00
PEP-585 complaint: remove type aliases (#93)
This commit is contained in:
@ -125,7 +125,7 @@ def test_packages_depend_on(repository: Repository, package_ahriman: Package, pa
|
||||
"""
|
||||
mocker.patch("ahriman.core.repository.repository.Repository.packages",
|
||||
return_value=[package_ahriman, package_python_schedule])
|
||||
assert repository.packages_depend_on([package_ahriman], ["python-srcinfo"]) == [package_ahriman]
|
||||
assert repository.packages_depend_on([package_ahriman], {"python-srcinfo"}) == [package_ahriman]
|
||||
|
||||
|
||||
def test_packages_depend_on_empty(repository: Repository, package_ahriman: Package, package_python_schedule: Package,
|
||||
|
@ -1,6 +1,6 @@
|
||||
import pytest
|
||||
|
||||
from typing import Any, Dict, List
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from ahriman.core.configuration import Configuration
|
||||
@ -24,12 +24,12 @@ def github(configuration: Configuration) -> Github:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def github_release() -> Dict[str, Any]:
|
||||
def github_release() -> dict[str, Any]:
|
||||
"""
|
||||
fixture for the github release object
|
||||
|
||||
Returns:
|
||||
Dict[str, Any]: github test release object
|
||||
dict[str, Any]: github test release object
|
||||
"""
|
||||
return {
|
||||
"url": "release_url",
|
||||
@ -74,12 +74,12 @@ def s3(configuration: Configuration) -> S3:
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def s3_remote_objects() -> List[MagicMock]:
|
||||
def s3_remote_objects() -> list[MagicMock]:
|
||||
"""
|
||||
fixture for boto3 like S3 objects
|
||||
|
||||
Returns:
|
||||
List[MagicMock]: boto3 like S3 objects test instance
|
||||
list[MagicMock]: boto3 like S3 objects test instance
|
||||
"""
|
||||
delete_mock = MagicMock()
|
||||
|
||||
|
@ -3,13 +3,13 @@ import requests
|
||||
|
||||
from pathlib import Path
|
||||
from pytest_mock import MockerFixture
|
||||
from typing import Any, Dict
|
||||
from typing import Any
|
||||
from unittest.mock import call as MockCall
|
||||
|
||||
from ahriman.core.upload.github import Github
|
||||
|
||||
|
||||
def test_asset_remove(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_asset_remove(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must remove asset from the release
|
||||
"""
|
||||
@ -18,7 +18,7 @@ def test_asset_remove(github: Github, github_release: Dict[str, Any], mocker: Mo
|
||||
request_mock.assert_called_once_with("DELETE", "asset_url")
|
||||
|
||||
|
||||
def test_asset_remove_unknown(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_asset_remove_unknown(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must not fail if no asset found
|
||||
"""
|
||||
@ -27,7 +27,7 @@ def test_asset_remove_unknown(github: Github, github_release: Dict[str, Any], mo
|
||||
request_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_asset_upload(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_asset_upload(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must upload asset to the repository
|
||||
"""
|
||||
@ -41,7 +41,7 @@ def test_asset_upload(github: Github, github_release: Dict[str, Any], mocker: Mo
|
||||
remove_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_asset_upload_with_removal(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_asset_upload_with_removal(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must remove existing file before upload
|
||||
"""
|
||||
@ -57,7 +57,7 @@ def test_asset_upload_with_removal(github: Github, github_release: Dict[str, Any
|
||||
])
|
||||
|
||||
|
||||
def test_asset_upload_empty_mimetype(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_asset_upload_empty_mimetype(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must upload asset to the repository with empty mime type if the library cannot guess it
|
||||
"""
|
||||
@ -80,7 +80,7 @@ def test_get_local_files(github: Github, resource_path_root: Path, mocker: Mocke
|
||||
walk_mock.assert_called()
|
||||
|
||||
|
||||
def test_files_remove(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_files_remove(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must remove files from the remote
|
||||
"""
|
||||
@ -89,7 +89,7 @@ def test_files_remove(github: Github, github_release: Dict[str, Any], mocker: Mo
|
||||
remove_mock.assert_called_once_with(github_release, "b")
|
||||
|
||||
|
||||
def test_files_remove_empty(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_files_remove_empty(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must remove nothing if nothing changed
|
||||
"""
|
||||
@ -98,7 +98,7 @@ def test_files_remove_empty(github: Github, github_release: Dict[str, Any], mock
|
||||
remove_mock.assert_not_called()
|
||||
|
||||
|
||||
def test_files_upload(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_files_upload(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must upload files to the remote
|
||||
"""
|
||||
@ -110,7 +110,7 @@ def test_files_upload(github: Github, github_release: Dict[str, Any], mocker: Mo
|
||||
])
|
||||
|
||||
|
||||
def test_files_upload_empty(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_files_upload_empty(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must upload nothing if nothing changed
|
||||
"""
|
||||
@ -167,7 +167,7 @@ def test_release_get_exception_http_error(github: Github, mocker: MockerFixture)
|
||||
github.release_get()
|
||||
|
||||
|
||||
def test_release_update(github: Github, github_release: Dict[str, Any], mocker: MockerFixture) -> None:
|
||||
def test_release_update(github: Github, github_release: dict[str, Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must update release
|
||||
"""
|
||||
|
@ -1,6 +1,6 @@
|
||||
from pathlib import Path
|
||||
from pytest_mock import MockerFixture
|
||||
from typing import Any, List, Optional, Tuple
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock, call as MockCall
|
||||
|
||||
from ahriman.core.upload.s3 import S3
|
||||
@ -33,7 +33,7 @@ def test_calculate_etag_small(resource_path_root: Path) -> None:
|
||||
assert S3.calculate_etag(path, _chunk_size) == "79b0f84e0232ed34fd191a85c383ecc5"
|
||||
|
||||
|
||||
def test_files_remove(s3_remote_objects: List[Any]) -> None:
|
||||
def test_files_remove(s3_remote_objects: list[Any]) -> None:
|
||||
"""
|
||||
must remove remote objects
|
||||
"""
|
||||
@ -46,11 +46,11 @@ def test_files_remove(s3_remote_objects: List[Any]) -> None:
|
||||
remote_objects[Path("x86_64/a")].delete.assert_called_once_with()
|
||||
|
||||
|
||||
def test_files_upload(s3: S3, s3_remote_objects: List[Any], mocker: MockerFixture) -> None:
|
||||
def test_files_upload(s3: S3, s3_remote_objects: list[Any], mocker: MockerFixture) -> None:
|
||||
"""
|
||||
must upload changed files
|
||||
"""
|
||||
def mimetype(path: Path) -> Tuple[Optional[str], None]:
|
||||
def mimetype(path: Path) -> tuple[str | None, None]:
|
||||
return ("text/html", None) if path.name == "b" else (None, None)
|
||||
|
||||
root = Path("path")
|
||||
@ -87,7 +87,7 @@ def test_get_local_files(s3: S3, resource_path_root: Path, mocker: MockerFixture
|
||||
walk_mock.assert_called()
|
||||
|
||||
|
||||
def test_get_remote_objects(s3: S3, s3_remote_objects: List[Any]) -> None:
|
||||
def test_get_remote_objects(s3: S3, s3_remote_objects: list[Any]) -> None:
|
||||
"""
|
||||
must generate list of remote objects by calling boto3 function
|
||||
"""
|
||||
|
Reference in New Issue
Block a user