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.
I'm snapshot testing a text file that gets generated in memory. The returned value is
bytes
. When a value isbytes
, it currently is always on one line, like this:It would be nice if bytes could be multiline, similar to strings, like this:
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.