MCPcopy Index your code
hub / github.com/plotly/plotly.py / test_image

Function test_image

plotly/matplotlylib/mplexporter/tests/test_basic.py:188–207  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

186
187
188def test_image():
189 # Test fails for matplotlib 1.5+ because the size of the image
190 # generated by matplotlib has changed.
191 if Version(matplotlib.__version__) == Version("3.4.1"):
192 image_size = 432
193 else:
194 pytest.skip("Test fails for older matplotlib")
195 np.random.seed(0) # image size depends on the seed
196 fig, ax = plt.subplots(figsize=(2, 2))
197 ax.imshow(np.random.random((10, 10)), cmap=plt.cm.jet, interpolation="nearest")
198 _assert_output_equal(
199 fake_renderer_output(fig, FakeRenderer),
200 f"""
201 opening figure
202 opening axes
203 draw image of size {image_size}
204 closing axes
205 closing figure
206 """,
207 )
208
209
210def test_legend():

Callers

nothing calls this directly

Calls 3

_assert_output_equalFunction · 0.85
fake_renderer_outputFunction · 0.85
subplotsMethod · 0.80

Tested by

no test coverage detected