Skip to content

Commit 33aca90

Browse files
committed
chore: py3.8 backwards compatibility fix
1 parent a753b7a commit 33aca90

File tree

5 files changed

+7
-5
lines changed

5 files changed

+7
-5
lines changed

src/syrupy/extensions/amber/serializer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ def object_attrs(cls, data: Any) -> "Iterable[str]":
371371
return (name for name in dir(data) if not name.startswith("_"))
372372

373373
@classmethod
374-
def object_as_named_tuple(cls, data: Any) -> "tuple[Any, ...]":
374+
def object_as_named_tuple(cls, data: Any) -> "Tuple[Any, ...]":
375375
attr_names = list(cls.object_attrs(data))
376376
return collections.namedtuple(data.__class__.__name__, attr_names)(
377377
**{prop: getattr(data, prop) for prop in attr_names}

src/syrupy/extensions/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def discover_snapshots(
111111
self,
112112
*,
113113
test_location: "PyTestLocation",
114-
ignore_extensions: Optional[list[str]] = None,
114+
ignore_extensions: Optional[List[str]] = None,
115115
) -> "SnapshotCollections":
116116
"""
117117
Returns all snapshot collections in test site

src/syrupy/report.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
Iterator,
2222
List,
2323
Set,
24+
Tuple,
2425
)
2526

2627
from _pytest.skipping import xfailed_key
@@ -390,7 +391,7 @@ def lines(self) -> Iterator[str]:
390391

391392
def __iterate_snapshot_collection(
392393
self, collection: "SnapshotCollections"
393-
) -> Generator[tuple[Generator[str, None, None], str], Any, None]:
394+
) -> Generator[Tuple[Generator[str, None, None], str], Any, None]:
394395
for snapshot_collection in collection:
395396
filepath = snapshot_collection.location
396397
snapshots = (snapshot.name for snapshot in snapshot_collection)

src/syrupy/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class SnapshotSession:
5555
pytest_session: "pytest.Session"
5656

5757
# List of file extensions to ignore during discovery/processing
58-
ignore_file_extensions: Optional[list[str]] = None
58+
ignore_file_extensions: Optional[List[str]] = None
5959

6060
# Snapshot report generated on finish
6161
report: Optional["SnapshotReport"] = None

src/syrupy/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
Any,
1010
Dict,
1111
Iterator,
12+
List,
1213
Optional,
1314
Sequence,
1415
Union,
@@ -33,7 +34,7 @@ def is_xdist_controller() -> bool:
3334

3435

3536
def walk_snapshot_dir(
36-
root: Union[str, Path], *, ignore_extensions: Optional[list[str]] = None
37+
root: Union[str, Path], *, ignore_extensions: Optional[List[str]] = None
3738
) -> Iterator[str]:
3839
ignore_exts: set[str] = set(ignore_extensions or [])
3940

0 commit comments

Comments
 (0)