Skip to content

Commit

Permalink
fix: typo in single file extension error message (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah committed Oct 6, 2021
1 parent 531f62e commit c4785f8
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions src/syrupy/extensions/single_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from pathlib import Path
from typing import (
TYPE_CHECKING,
Any,
Optional,
Set,
)
Expand All @@ -16,11 +15,22 @@
from .base import AbstractSyrupyExtension

if TYPE_CHECKING:
from syrupy.types import SerializableData
from syrupy.types import (
PropertyFilter,
PropertyMatcher,
SerializableData,
SerializedData,
)


class SingleFileSnapshotExtension(AbstractSyrupyExtension):
def serialize(self, data: "SerializableData", **kwargs: Any) -> bytes:
def serialize(
self,
data: "SerializableData",
*,
exclude: Optional["PropertyFilter"] = None,
matcher: Optional["PropertyMatcher"] = None,
) -> SerializedData:
return bytes(data)

def get_snapshot_name(self, *, index: int = 0) -> str:
Expand Down Expand Up @@ -62,7 +72,7 @@ def _read_snapshot_data_from_location(
def _write_snapshot_fossil(self, *, snapshot_fossil: "SnapshotFossil") -> None:
filepath, data = snapshot_fossil.location, next(iter(snapshot_fossil)).data
if not isinstance(data, bytes):
error_text = gettext("Can write non binary data. Expected '{}', got '{}'")
error_text = gettext("Can't write non binary data. Expected '{}', got '{}'")
raise TypeError(error_text.format(bytes.__name__, type(data).__name__))
with open(filepath, "wb") as f:
f.write(data)
Expand Down

0 comments on commit c4785f8

Please sign in to comment.