Verify that writing to a BytesIO object contains the same data as to_image(). The goal of this test is to ensure that Plotly correctly handles a writable buffer which doesn't correspond to a filesystem path.
()
| 160 | |
| 161 | |
| 162 | def test_bytesio(): |
| 163 | """Verify that writing to a BytesIO object contains the same data as to_image(). |
| 164 | |
| 165 | The goal of this test is to ensure that Plotly correctly handles a writable buffer |
| 166 | which doesn't correspond to a filesystem path. |
| 167 | """ |
| 168 | bio = BytesIO() |
| 169 | pio.write_image(fig, bio, format="jpg", engine="kaleido", validate=False) |
| 170 | bio.seek(0) # Rewind to the beginning of the buffer, otherwise read() returns b''. |
| 171 | bio_bytes = bio.read() |
| 172 | to_image_bytes = pio.to_image(fig, format="jpg", engine="kaleido", validate=False) |
| 173 | assert bio_bytes == to_image_bytes |
| 174 | |
| 175 | |
| 176 | def test_defaults(): |
nothing calls this directly
no test coverage detected