Skip to content

Multiline bytes? #171

@spenserblack

Description

@spenserblack

I'm snapshot testing a text file that gets generated in memory. The returned value is bytes. When a value is bytes, it currently is always on one line, like this:

b'HEADER\r\ncontent'

It would be nice if bytes could be multiline, similar to strings, like this:

b'''HEADER\r
content'''

Of course, there are going to be bytes that are binary and don't really contain any readable text to format. Perhaps .isalnum() can be used as a best guess if the bytes are text that should be multiline vs binary that should not be multiline.

The current workaround is to just decode the bytes to a string first so that the snapshot test is prettier. However, ideally, I feel that there shouldn't be any "processing" between the actual value and the tested/asserted value.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions