generated from tophat/new-project-kit
-
Notifications
You must be signed in to change notification settings - Fork 34
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
- Loading branch information
Noah Negin-Ulster
committed
Feb 2, 2023
1 parent
4ca0716
commit f416e9a
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 |
f416e9a
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.8519307970540954
iter/sec (stddev: 0.04250003887862266
)0.8381195242511715
iter/sec (stddev: 0.04240394140227035
)0.98
benchmarks/test_1000x.py::test_1000x_writes
0.8294705214642212
iter/sec (stddev: 0.04382226508079675
)0.8626650008455868
iter/sec (stddev: 0.05153168408309042
)1.04
benchmarks/test_standard.py::test_standard
0.8007524641437735
iter/sec (stddev: 0.04672476665369741
)0.7465173870618954
iter/sec (stddev: 0.1502009356924296
)0.93
This comment was automatically generated by workflow using github-action-benchmark.