Skip to content

.ambr snapshot files have meaningful trailing whitespace #619

@harrysarson

Description

@harrysarson

Describe the bug

When generating snapshots from mutliline strings the text is idented in the snapshot file. This means that empty lines in multiline strings generate lines containing only (trailling) whitespace in the line.

Trimming this whitespace then invalidates the snapshot causing the test to fail.

To reproduce

def test(snapshot):
    lines = "\n".join([
        "line 1",
        "", # empty string
        "line 3"
    ])
    assert lines == snapshot

This test passes fine.

Then trim trailing whitespace on the generated snapshot.

Now the test fails.

Expected behavior

Snapshot files shouldn't have meaningful trailing whitespace.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions