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.
feat: support overriding the amber serializer class (#683)
- Loading branch information
Showing
6 changed files
with
173 additions
and
58 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
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
76 changes: 76 additions & 0 deletions
76
tests/syrupy/extensions/amber_sorted/__snapshots__/test_amber_sort.ambr
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 |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# serializer version: 1-sorted | ||
# name: test_many_sorted | ||
0 | ||
# --- | ||
# name: test_many_sorted.1 | ||
1 | ||
# --- | ||
# name: test_many_sorted.2 | ||
2 | ||
# --- | ||
# name: test_many_sorted.3 | ||
3 | ||
# --- | ||
# name: test_many_sorted.4 | ||
4 | ||
# --- | ||
# name: test_many_sorted.5 | ||
5 | ||
# --- | ||
# name: test_many_sorted.6 | ||
6 | ||
# --- | ||
# name: test_many_sorted.7 | ||
7 | ||
# --- | ||
# name: test_many_sorted.8 | ||
8 | ||
# --- | ||
# name: test_many_sorted.9 | ||
9 | ||
# --- | ||
# name: test_many_sorted.10 | ||
10 | ||
# --- | ||
# name: test_many_sorted.11 | ||
11 | ||
# --- | ||
# name: test_many_sorted.12 | ||
12 | ||
# --- | ||
# name: test_many_sorted.13 | ||
13 | ||
# --- | ||
# name: test_many_sorted.14 | ||
14 | ||
# --- | ||
# name: test_many_sorted.15 | ||
15 | ||
# --- | ||
# name: test_many_sorted.16 | ||
16 | ||
# --- | ||
# name: test_many_sorted.17 | ||
17 | ||
# --- | ||
# name: test_many_sorted.18 | ||
18 | ||
# --- | ||
# name: test_many_sorted.19 | ||
19 | ||
# --- | ||
# name: test_many_sorted.20 | ||
20 | ||
# --- | ||
# name: test_many_sorted.21 | ||
21 | ||
# --- | ||
# name: test_many_sorted.22 | ||
22 | ||
# --- | ||
# name: test_many_sorted.23 | ||
23 | ||
# --- | ||
# name: test_many_sorted.24 | ||
24 | ||
# --- |
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import pytest | ||
|
||
from syrupy.extensions.amber import ( | ||
AmberDataSerializerSorted, | ||
AmberSnapshotExtension, | ||
) | ||
|
||
|
||
class AmberSortedSnapshotExtension(AmberSnapshotExtension): | ||
serializer_class = AmberDataSerializerSorted | ||
|
||
|
||
@pytest.fixture | ||
def snapshot(snapshot): | ||
return snapshot.use_extension(AmberSortedSnapshotExtension) | ||
|
||
|
||
def test_many_sorted(snapshot): | ||
for i in range(25): | ||
assert i == snapshot |
662c93f
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.5341319969507773
iter/sec (stddev: 0.07128995514696808
)0.8381195242511715
iter/sec (stddev: 0.04240394140227035
)1.57
benchmarks/test_1000x.py::test_1000x_writes
0.5217680846071134
iter/sec (stddev: 0.08274122550544077
)0.8626650008455868
iter/sec (stddev: 0.05153168408309042
)1.65
benchmarks/test_standard.py::test_standard
0.5065343890498211
iter/sec (stddev: 0.12248840331953859
)0.7465173870618954
iter/sec (stddev: 0.1502009356924296
)1.47
This comment was automatically generated by workflow using github-action-benchmark.