Page MenuHomeSoftware Heritage

D3543.id12495.diff
No OneTemporary

D3543.id12495.diff

diff --git a/swh/loader/package/nixguix/tests/test_nixguix.py b/swh/loader/package/nixguix/tests/test_nixguix.py
--- a/swh/loader/package/nixguix/tests/test_nixguix.py
+++ b/swh/loader/package/nixguix/tests/test_nixguix.py
@@ -11,7 +11,7 @@
from json.decoder import JSONDecodeError
from swh.storage.interface import StorageInterface
-from typing import Any, Dict, Iterable, Optional, Tuple, Union
+from typing import Dict, Iterable, Optional, Tuple
from unittest.mock import patch
@@ -53,7 +53,7 @@
def check_snapshot(
- snapshot: Union[Dict[str, Any], Snapshot],
+ snapshot: Snapshot,
storage: StorageInterface,
allowed_empty: Iterable[Tuple[TargetType, bytes]] = [
(TargetType.REVISION, b"evaluation")
diff --git a/swh/loader/tests/__init__.py b/swh/loader/tests/__init__.py
--- a/swh/loader/tests/__init__.py
+++ b/swh/loader/tests/__init__.py
@@ -8,7 +8,7 @@
from collections import defaultdict
from pathlib import PosixPath
-from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
+from typing import Dict, Iterable, List, Optional, Tuple, Union
from swh.model.model import OriginVisitStatus, Snapshot, TargetType
from swh.model.hashutil import hash_to_bytes
@@ -114,7 +114,7 @@
def check_snapshot(
- snapshot: Union[Dict[str, Any], Snapshot],
+ snapshot: Snapshot,
storage: StorageInterface,
allowed_empty: Iterable[Tuple[TargetType, bytes]] = [],
):
@@ -135,8 +135,6 @@
needed.
"""
- if isinstance(snapshot, dict):
- snapshot = Snapshot.from_dict(snapshot)
if not isinstance(snapshot, Snapshot):
raise AssertionError(f"variable 'snapshot' must be a snapshot: {snapshot!r}")
diff --git a/swh/loader/tests/test_init.py b/swh/loader/tests/test_init.py
--- a/swh/loader/tests/test_init.py
+++ b/swh/loader/tests/test_init.py
@@ -347,11 +347,10 @@
"snapshot:add": 1,
}
- for snap in [SNAPSHOT, SNAPSHOT.to_dict()]:
- # all should be fine!
- check_snapshot(
- snap, swh_storage, allowed_empty=[(TargetType.REVISION, b"evaluation")]
- )
+ # all should be fine!
+ check_snapshot(
+ SNAPSHOT, swh_storage, allowed_empty=[(TargetType.REVISION, b"evaluation")]
+ )
def test_check_snapshot_failures(swh_storage):

File Metadata

Mime Type
text/plain
Expires
Dec 19 2024, 11:44 PM (11 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3226074

Event Timeline