Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

fix(serializer): preserve trailing newlines in ambr serialization #950

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

noahnu
Copy link
Collaborator

@noahnu noahnu commented Feb 17, 2025

BREAKING CHANGE: Trailing newlines are now preserved in amber serialization. This mostly affects serialization of custom repr implementations.

Closes #925

@noahnu noahnu linked an issue Feb 17, 2025 that may be closed by this pull request
@@ -168,7 +172,7 @@ def __read_file_with_markers(
if test_name and snapshot_data:
yield Snapshot(
name=test_name,
data=snapshot_data.rstrip(os.linesep),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were trimming too much. Only meant to trim the last char

Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #950      +/-   ##
==========================================
- Coverage   97.83%   97.77%   -0.07%     
==========================================
  Files          21       21              
  Lines        1616     1617       +1     
==========================================
  Hits         1581     1581              
- Misses         35       36       +1     

BREAKING CHANGE: Trailing newlines are now preserved in amber
serialization. This mostly affects serialization of custom repr
implementations.
@noahnu noahnu merged commit 3f747c6 into next Feb 17, 2025
13 of 14 checks passed
@noahnu noahnu deleted the bugfix/925 branch February 17, 2025 16:51
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: b77b005 Previous: b7f5a9d Ratio
benchmarks/test_1000x.py::test_1000x_reads 0.7738313676687634 iter/sec (stddev: 0.07879161063425968) 0.7985141212181278 iter/sec (stddev: 0.05282275712328596) 1.03
benchmarks/test_1000x.py::test_1000x_writes 0.6639295546681687 iter/sec (stddev: 0.2627945070184551) 0.698901352248691 iter/sec (stddev: 0.24551960819132626) 1.05
benchmarks/test_standard.py::test_standard 0.6855419304758074 iter/sec (stddev: 0.10011401104717381) 0.7294161208407376 iter/sec (stddev: 0.06718845368778603) 1.06

This comment was automatically generated by workflow using github-action-benchmark.

noahnu added a commit that referenced this pull request Feb 20, 2025
BREAKING CHANGE: Trailing newlines are now preserved in amber
serialization. This mostly affects serialization of custom repr
implementations.
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saved snapshot fails to match if repr ends with newline
1 participant