MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_invalid_log_lims

Function test_invalid_log_lims

lib/matplotlib/tests/test_scale.py:217–238  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215
216
217def test_invalid_log_lims():
218 # Check that invalid log scale limits are ignored
219 fig, ax = plt.subplots()
220 ax.scatter(range(0, 4), range(0, 4))
221
222 ax.set_xscale('log')
223 original_xlim = ax.get_xlim()
224 with pytest.warns(UserWarning):
225 ax.set_xlim(left=0)
226 assert ax.get_xlim() == original_xlim
227 with pytest.warns(UserWarning):
228 ax.set_xlim(right=-1)
229 assert ax.get_xlim() == original_xlim
230
231 ax.set_yscale('log')
232 original_ylim = ax.get_ylim()
233 with pytest.warns(UserWarning):
234 ax.set_ylim(bottom=0)
235 assert ax.get_ylim() == original_ylim
236 with pytest.warns(UserWarning):
237 ax.set_ylim(top=-1)
238 assert ax.get_ylim() == original_ylim
239
240
241@image_comparison(['function_scales.png'], remove_text=True, style='mpl20')

Callers

nothing calls this directly

Calls 8

set_xscaleMethod · 0.80
subplotsMethod · 0.45
scatterMethod · 0.45
get_xlimMethod · 0.45
set_xlimMethod · 0.45
set_yscaleMethod · 0.45
get_ylimMethod · 0.45
set_ylimMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…