Skip to content

Commit

Permalink
fix: NameError when importing SingleFileSnapshotExtension (#557)
Browse files Browse the repository at this point in the history
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 "<stdin>", line 1, in <module>
  File "/Users/jocke/projects/syrupy/src/syrupy/extensions/single_file.py", line 26, in <module>
    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
```
  • Loading branch information
joakimnordling authored Oct 13, 2021
1 parent 3a4ce75 commit 935e256
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/syrupy/extensions/single_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 935e256

Please sign in to comment.