From 935e2563b55dc295821619d4eac318d8035296e5 Mon Sep 17 00:00:00 2001 From: Joakim Nordling Date: Wed, 13 Oct 2021 14:16:00 +0300 Subject: [PATCH] fix: NameError when importing SingleFileSnapshotExtension (#557) If you try to import `SingleFileSnapshotExtension` it will raise `NameError: name 'SerializedData' is not defined` because SerializedData is only imported if type checking and the return type annotation was not quoted. Example: ``` >>> from syrupy.extensions.single_file import SingleFileSnapshotExtension Traceback (most recent call last): File "", line 1, in File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 26, in class SingleFileSnapshotExtension(AbstractSyrupyExtension): File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 33, in SingleFileSnapshotExtension ) -> SerializedData: NameError: name 'SerializedData' is not defined ``` --- src/syrupy/extensions/single_file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/syrupy/extensions/single_file.py b/src/syrupy/extensions/single_file.py index f6739a7e..4af378fc 100644 --- a/src/syrupy/extensions/single_file.py +++ b/src/syrupy/extensions/single_file.py @@ -30,7 +30,7 @@ def serialize( *, exclude: Optional["PropertyFilter"] = None, matcher: Optional["PropertyMatcher"] = None, - ) -> SerializedData: + ) -> "SerializedData": return bytes(data) def get_snapshot_name(self, *, index: int = 0) -> str: