MCPcopy Create free account
hub / github.com/plotly/plotly.py / test_imshow_compression

Function test_imshow_compression

tests/test_optional/test_px/test_imshow.py:376–390  ·  view source on GitHub ↗
(level)

Source from the content-addressed store, hash-verified

374
375@pytest.mark.parametrize("level", [0, 3, 6, 9])
376def test_imshow_compression(level):
377 _, grid_img = np.mgrid[0:10, 0:100]
378 grid_img = grid_img.astype(np.uint8)
379 fig = px.imshow(
380 grid_img,
381 binary_string=True,
382 binary_compression_level=level,
383 contrast_rescaling="infer",
384 )
385 decoded_img = decode_image_string(fig.data[0].source)
386 assert np.all(decoded_img == grid_img)
387 if level > 0:
388 assert len(fig.data[0].source) < grid_img.size
389 else:
390 assert len(fig.data[0].source) > grid_img.size
391
392
393@pytest.mark.parametrize("level", [-1, 10])

Callers

nothing calls this directly

Calls 1

decode_image_stringFunction · 0.85

Tested by

no test coverage detected