generated from tophat/new-project-kit
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: simplify data serializer for ambr (#676)
* refactor: simplify data serializer for ambr * feat: introduce concept of a tainted snapshot BREAKING CHANGE: Serializers may now throw a TaintedSnapshotError which will tell the user to regenerate the snapshot even if the underlying data has not changed. This is to support rolling out more subtle changes to the serializers, such as the introduction of serializer metadata. BREAKING CHANGE: Renamed DataSerializer to AmberDataSerializer.
- Loading branch information
Showing
20 changed files
with
209 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,21 @@ | ||
from typing import Optional | ||
|
||
from syrupy.types import SerializedData | ||
|
||
|
||
class SnapshotDoesNotExist(Exception): | ||
"""Snapshot does not exist""" | ||
|
||
|
||
class FailedToLoadModuleMember(Exception): | ||
"""Failed to load specific member in a module""" | ||
|
||
|
||
class TaintedSnapshotError(Exception): | ||
"""The snapshot needs to be regenerated.""" | ||
|
||
snapshot_data: Optional["SerializedData"] | ||
|
||
def __init__(self, snapshot_data: Optional["SerializedData"] = None) -> None: | ||
super().__init__() | ||
self.snapshot_data = snapshot_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
3d296e1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
benchmarks/test_1000x.py::test_1000x_reads
0.8414131647996508
iter/sec (stddev: 0.04099141291505383
)0.8381195242511715
iter/sec (stddev: 0.04240394140227035
)1.00
benchmarks/test_1000x.py::test_1000x_writes
0.8196875242073718
iter/sec (stddev: 0.047827666637548824
)0.8626650008455868
iter/sec (stddev: 0.05153168408309042
)1.05
benchmarks/test_standard.py::test_standard
0.7870675206649624
iter/sec (stddev: 0.0533161189311347
)0.7465173870618954
iter/sec (stddev: 0.1502009356924296
)0.95
This comment was automatically generated by workflow using github-action-benchmark.