Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Multiline bytes? #171

Open
spenserblack opened this issue Nov 30, 2023 · 0 comments
Open

Multiline bytes? #171

spenserblack opened this issue Nov 30, 2023 · 0 comments

Comments

@spenserblack
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant